Commit Graph

119 Commits

Author SHA1 Message Date
Anders Kaseorg
1a8429e338 CVE-2025-52559: Generate HTML for digest message sender safely.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-07-02 11:40:26 -07:00
Anders Kaseorg
1205d7603c requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 5a090c47ad)
2025-06-26 17:40:12 -07:00
Anders Kaseorg
9c1fcfb69f requirements: Remove python-twitter.
Commit dce4a3c98e (#25816) removed
Twitter support.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 013be33b20)
2025-06-26 17:40:12 -07:00
Anders Kaseorg
ea27b848fc mypy: Add types-requests-oauthlib, types-uwsgi.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 0b776e2c15)
2025-06-26 17:40:12 -07:00
Anders Kaseorg
512613ead4 requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-03-14 17:31:50 -07:00
Anders Kaseorg
7866dc5ad8 ruff: Fix S704 Unsafe use of markupsafe.Markup detected.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-03-14 17:31:50 -07:00
Anders Kaseorg
f8bbf228ef pyproject: Remove py3dns.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-02-25 11:53:08 -08:00
Anders Kaseorg
d7556b4060 requirements: Migrate to uv.
https://docs.astral.sh/uv/

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-02-24 22:29:24 -08:00
Anders Kaseorg
df7ad517c5 requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-02-18 22:04:43 -08:00
Anders Kaseorg
2aff7ce9b5 ruff: Remove ISC001 ignore.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-01-14 09:42:16 -08:00
Anders Kaseorg
2709e7a636 requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-12-21 21:06:53 -08:00
Anders Kaseorg
c48ef926e1 mypy: Add types-defusedxml.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-11-19 11:09:34 -08:00
Anders Kaseorg
532aee926c requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-11-19 11:09:34 -08:00
Anders Kaseorg
b3f18b805d ruff: Enable B008 function-call-in-default-argument.
https://docs.astral.sh/ruff/rules/function-call-in-default-argument/

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-11-10 22:43:55 -08:00
Alex Vandiver
674ca1a95d restart-server: Wait until chain reload has completed.
We should not proceed and send client reload events until we know that
all of the server processes have updated to the latest version, or
they may reload into the old server version if they hit a Django
worker which has not yet restarted.

Because the logic controlling the number of workers is mildly complex,
and lives in Puppet, use the `uwsgi` Python bindings to know when the
process being reloaded is the last one, and use that to write out a
file signifying the success of the chain reload.  `restart-server`
awaits the creation of this file before proceeding.
2024-08-29 12:12:34 -07:00
Anders Kaseorg
b96feb34f6 ruff: Fix SIM117 Use a single with statement with multiple contexts.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-14 13:48:32 -07:00
Anders Kaseorg
48202389b8 ruff: Bump target-version from py38 to py310.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg
d6fdaff31f ruff: Enable FURB rules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-06-30 22:37:15 -07:00
Anders Kaseorg
c31cebbf68 mypy: Remove some unused ignore_missing_imports overrides.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-06-26 23:01:49 -07:00
Alex Vandiver
fd50f12548 requirements: Remove now-unused cairosvg. 2024-06-20 23:06:08 -04:00
Alex Vandiver
475d4800f9 thumbnailing: Add pyvips dependency. 2024-06-20 23:06:08 -04:00
Mateusz Mandera
4917e01ffb push_notifications: Migrate to FCM HTTP v1 API.
The legacy API we use via python-gcm is deprecated and about to be
disabled.

Fixes #29768.
2024-06-17 18:26:26 -07:00
Anders Kaseorg
d32d4434dd partial: Replace returns plugin with an annotation.
The returns plugin hasn’t been updated for mypy ≥ 1.6.  This
annotation is more limited in that it only supports a fixed number of
positional arguments and no keyword arguments, but is good enough for
our purposes.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-29 17:14:41 -07:00
Anders Kaseorg
f618971668 ruff: Enable more rules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-01 09:27:48 -08:00
Anders Kaseorg
570f3dd447 python: Reformat with Ruff formatter.
https://docs.astral.sh/ruff/formatter/

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-29 17:07:16 -08:00
Charlie Marsh
c8e77b6cac ruff: Upgrade configuration for Ruff v0.2.0. 2024-02-02 10:30:45 -08:00
Anders Kaseorg
f8aac58a6a docs: Update Ruff badge and links.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-26 15:51:46 -07:00
Anders Kaseorg
a50eb2e809 mypy: Enable new error explicit-override.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-12 12:28:41 -07:00
Anders Kaseorg
b4a2e71b6b mypy: Enable new errors redundant-self, truthy-iterable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-12 12:28:41 -07:00
Anders Kaseorg
6988622fe8 ruff: Enable B023 Function definition does not bind loop variable.
Python’s loop scoping is misdesigned, resulting in a very common
gotcha for functions that close over loop variables [1].  The general
problem is so bad that even the Go developers plan to break
compatibility in order to fix the same design mistake in their
language [2].

Enable the Ruff rule function-uses-loop-variable (B023) [3], which
conservatively prohibits functions from binding loop variables at all.

[1] https://docs.python-guide.org/writing/gotchas/#late-binding-closures
[2] https://go.dev/s/loopvar-design
[3] https://beta.ruff.rs/docs/rules/function-uses-loop-variable/

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-11 18:03:45 -07:00
Anders Kaseorg
cf4791264c python: Replace functools.partial with type-safe returns.curry.partial.
The type annotation for functools.partial uses unchecked Any for all
the function parameters (both early and late).  returns.curry.partial
uses a mypy plugin to check the parameters safely.

https://returns.readthedocs.io/en/latest/pages/curry.html

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-11 18:03:45 -07:00
Anders Kaseorg
22e8b641e1 mypy: Remove exemption for aioapns.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-09 10:10:24 -07:00
Anders Kaseorg
ddba558f1d mypy: Remove no_implicit_reexport override.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-08 16:46:44 -07:00
Anders Kaseorg
5fe0cb3054 pyproject: Delete trailing whitespace.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-08 10:13:47 -07:00
Zixuan James Li
7da4e73d57 requirements: Add pydantic and configure mypy plugin.
Along with pydantic we add annotated_types for Annotated utils that can
be used for more specific validation constraints.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-09-08 08:20:17 -07:00
Anders Kaseorg
ca40e60469 ruff: Enable PERF rules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-07 17:23:55 -07:00
Anders Kaseorg
55aa29bef4 ruff: Fix FLY002 Consider f"…" instead of string join.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-07 17:12:41 -07:00
Anders Kaseorg
733083c65d ruff: Collapse short multi-line import statements.
isort did this by default, though it’s unclear whether that was
intended; see https://github.com/astral-sh/ruff/issues/4153.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-02 17:41:41 -07:00
Anders Kaseorg
ff409342e1 runtornado: Fix COM818 Trailing comma on bare tuple prohibited.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-31 13:35:04 -07:00
Anders Kaseorg
29bdaaf5b5 requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-19 16:14:59 -07:00
Anders Kaseorg
ff6cf54716 pyproject: Remove mypy exemption for coverage.
coverage added type annotations in 7.2.0.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-19 16:14:59 -07:00
Anders Kaseorg
03b3c8522d requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-25 21:20:33 -07:00
Anders Kaseorg
9db3451333 Remove statsd support.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-25 19:58:16 -07:00
Alex Vandiver
e536a14b61 report_error: Remove API endpoint for client error reporting. 2023-04-13 14:59:58 -07:00
Anders Kaseorg
b3a185103d ruff: Enable new lints INT, PYI.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-12 17:32:38 -07:00
Anders Kaseorg
bb2c0ad3bf ruff: Enable Django rules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-12 17:32:38 -07:00
Anders Kaseorg
a881918a05 requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-03 22:39:21 -07:00
Anders Kaseorg
144166cdc4 mypy: Remove exclusions for unused cssutils and premailer packages.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-03 16:52:51 -07:00
Anders Kaseorg
087660a87e requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-05 14:46:28 -08:00
Anders Kaseorg
5aaa36b8fc ruff: Enable logging format rules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-04 16:36:20 -08:00