Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
408 lines (383 loc) · 13.3 KB
/
Copy pathpyproject.toml
File metadata and controls
408 lines (383 loc) · 13.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
[build-system]
# uv runs its bundled copy of this backend in-process, so editable installs
# need no build environment. Other build frontends fetch uv_build from the index.
requires = ["uv_build>=0.13.5,<0.14"]
build-backend = "uv_build"
[project]
name = "sentry"
# Bumped by scripts/bump-version.sh, together with uv.lock and VERSION in
# src/sentry/__init__.py. Vulnerability scanners and pip resolve plugins
# against this version, so it must not be a placeholder.
version = "26.12.0.dev0"
# without this uv derives requires-python from whichever interpreter runs it,
# so `uv lock` under python 3.14 (e.g. dependabot) resolves for >=3.14 and fails
# on wheel-only packages such as backports-zstd that have no cp314 wheels
requires-python = ">=3.13"
dependencies = [
"asyncpg>=0.31.0",
"backports-zstd>=1.3.0",
"beautifulsoup4>=4.7.1",
"boto3>=1.34.128",
"botocore>=1.34.128",
"brotli>=1.2.1",
"cachetools>=5.3.0",
"click>=8.2.1",
"confluent-kafka>=2.8.0",
"cronsim>=2.6",
"cryptography>=50.0.0",
"cssselect>=1.0.3",
"datadog>=0.49.1",
"django>=5.2.19",
"django-crispy-forms>=1.14.0",
"django-csp>=3.8",
"django-pg-zero-downtime-migrations>=0.18",
"djangorestframework>=3.18.2",
"drf-spectacular>=0.27.2",
"emmett55>=1.3.0",
"emmett-prometheus>=0.3.0",
"emmett-sentry>=0.10.0",
"fido2>=0.9.2",
"google-api-core>=2.19.1",
"google-auth>=2.29.0",
"google-cloud-bigtable>=2.30.1",
"google-cloud-build>=3.24.2",
"google-cloud-core>=2.4.1",
"google-cloud-functions>=1.17.0",
"google-cloud-kms>=2.24.2",
"google-cloud-logging>=3.10.0",
"google-cloud-pubsub>=2.23.0",
"google-cloud-spanner>=3.49.0",
"google-cloud-storage>=2.18.0",
"google-cloud-storage-transfer>=1.17.0",
"google-crc32c>=1.6.0",
"google-re2>=1.1.20251105",
"googleapis-common-protos>=1.63.2",
"granian[pname,reload,uvloop]>=2.8",
"grpc-google-iam-v1>=0.13.1",
# Note, grpcio>1.30.0 requires setting GRPC_POLL_STRATEGY=epoll1
# See https://github.com/grpc/grpc/issues/23796 and
# https://github.com/grpc/grpc/blob/v1.35.x/doc/core/grpc-polling-engines.md#polling-engine-implementations-in-grpc
"grpcio>=1.84.1",
# not directly used, but provides a speedup for redis
"hiredis>=2.3.2",
"jinja2>=3.1.6",
"jsonschema>=4.20.0",
"lxml>=6.1.0",
"maxminddb>=2.3.0",
"mistune>=3.3.4",
"mmh3>=4.0.0",
"msgspec>=0.19.0",
"msgpack>=1.2.3",
"objectstore-client>=0.3.1",
"orjson>=3.10.10",
"packaging>=24.1",
"parsimonious>=0.10.0",
"petname>=2.6",
"phonenumberslite>=8.12.55",
"pillow>=13.0.0",
"proto-plus>=1.25.0",
"protobuf>=5.29.6",
"psutil>=5.9.7",
"psycopg2-binary>=2.9.10",
"punkreq>=0.4.0",
"pydantic>=1.10.26,<2",
"pymemcache>=4.0.0",
"pyjwt>=2.13.0",
"python-dateutil>=2.9.0.post0",
"python-rapidjson>=1.23",
"python-u2flib-server>=5.0.0",
"python3-saml>=1.15.0",
"redis>=3.4.1",
"redis-py-cluster>=2.1.3",
"requests>=2.33.0",
"requests-oauthlib>=1.2.0",
# [start] jsonschema format validators
"rfc3339-validator>=0.1.2",
"rfc3986-validator>=0.1.1",
# [end] jsonschema format validators
"sentry-arroyo>=2.50.1",
"sentry-conventions>=0.37.0",
"sentry-forked-email-reply-parser>=0.5.12.post1",
"sentry-kafka-schemas>=3.0.2",
"sentry-ophio>=1.3.1",
# sentry-options is only used in getsentry for now
"sentry-options>=1.2.15",
"sentry-protos>=0.135.0",
"sentry-redis-tools>=0.5.0",
"sentry-viewercontext>=0.2.0",
"sentry-relay>=0.10.3",
"sentry-scm>=4.2.0",
"sentry-sdk[http2]>=3.1.0b3",
"sentry-usage-accountant>=0.0.10",
"simplejson>=3.17.6",
"slack-sdk>=3.40.1",
"snuba-sdk>=3.0.43",
"sqlparse>=0.5.0",
"statsd>=3.3.0",
"structlog>=22.1.0",
"symbolic>=14.0.0a4",
"taskbroker-client>=0.20.38",
"tokenizers>=0.22.0",
"tldextract>=5.1.2",
"toronado>=0.1.0",
"typing-extensions>=4.12.0",
"tzdata>=2026.4",
"ua-parser>=0.10.0",
"unidiff>=0.7.4",
# note: we cannot resolve urllib3[brotli] but brotli is installed
# and will be used
"urllib3>=2.7.0",
"vroomrs>=0.1.24",
"xmlsec>=1.3.17",
"zstandard>=0.18.0",
# [begin] getsentry
# there's very few here so just include them here otherwise if they're
# in an extra, regular `uv sync` will uninstall them, and people will
# be confused
"avalara>=20.9.0",
"iso3166>=2.1.1",
"pycountry>=17.5.14",
"pyvat>=1.3.15",
"reportlab>=4.4.0",
"stripe>=6.7.0",
# [end] getsentry
]
[tool.uv]
# only lock for the python we run (.python-version); our internal pypi lacks
# wheels for some packages on newer pythons, so resolving for them fails
environments = [
"(sys_platform == 'darwin' or sys_platform == 'linux') and python_version < '3.14'",
]
[[tool.uv.index]]
# We don't allow using public pypi - submit a PR to
# https://github.com/getsentry/pypi to add a dependency.
name = "sentry-pypi"
url = "https://pypi.devinfra.sentry.io/simple"
default = true
[[tool.uv.index]]
# Org-level Dependabot registry. Declaring it here stops Dependabot from
# passing it as `--default-index`; `explicit` keeps uv from ever using it.
name = "sfw"
url = "https://sfw.security.sentry.io/pypi/simple"
explicit = true
[project.scripts]
sentry = "sentry.__main__:main"
[project.entry-points."sentry.apps"]
# TODO: This can be removed once the getsentry tests no longer check for this app
auth_activedirectory = "sentry.auth.providers.saml2.activedirectory"
auth_auth0 = "sentry.auth.providers.saml2.auth0"
auth_github = "sentry.auth.providers.github"
auth_jumpcloud = "sentry.auth.providers.saml2.jumpcloud"
auth_okta = "sentry.auth.providers.saml2.okta"
auth_onelogin = "sentry.auth.providers.saml2.onelogin"
auth_rippling = "sentry.auth.providers.saml2.rippling"
auth_saml2 = "sentry.auth.providers.saml2.generic"
[tool.uv.build-backend]
module-name = ["apigw", "bitfield", "sentry", "social_auth", "sudo"]
[dependency-groups]
dev = [
"codeowners-coverage>=0.3.0",
"covdefaults>=2.3.0",
"devservices>=1.5.5",
"docker>=7.1.0",
"ephemeral-port-reserve>=1.1.4",
"flake8>=7.3.0",
"honcho>=2.0.0",
"lxml-stubs>=0.4.0",
"msgpack-types>=0.2.0",
"mypy>=2.1.0",
"mypy-extensions>=1.0.0",
"openapi-core>=0.18.2",
"openapi-pydantic>=0.4.1",
"prek>=0.3.6",
"pytest>=9.1.1",
"pytest-cov>=4.0.0",
"pytest-django>=4.12.0",
"pytest-fail-slow>=0.3.0",
"pytest-json-report>=1.5.0",
"pytest-rerunfailures>=16.2",
"pytest-sentry>=0.7.0",
"pytest-xdist>=3.8.0",
"responses>=0.23.1",
"ruff>=0.14.0",
"selenium>=4.16.0",
"sentry-covdefaults-disable-branch-coverage>=1.0.2",
"sentry-devenv>=1.40.0",
"django-stubs>=5.2.9",
"djangorestframework-stubs>=3.16.8",
"time-machine>=2.16.0",
"types-beautifulsoup4>=4.11.6",
"types-cachetools>=5.3.0.5",
"types-docker>=7.1.0.20250705",
"types-jsonschema>=4.16.1",
"types-oauthlib>=3.2.0.8",
"types-parsimonious>=0.10.0.8",
"types-pillow>=9.5.0.4",
"types-protobuf>=4.23.0.1",
"types-psutil>=5.9.5.16",
"types-psycopg2>=2.9.21",
"types-python-dateutil>=2.8.19",
"types-pyyaml>=6.0.11",
"types-redis>=3.5.18",
"types-requests>=2.32.0.20241016",
"types-requests-oauthlib>=2.0.0.20250119",
"types-simplejson>=3.17.7.2",
"types-unidiff>=0.7.0.20240505",
]
image-debug = [
"memray==1.20.0",
]
[tool.ruff]
line-length = 100
target-version = "py313"
[tool.ruff.format]
# Use black-compatible defaults
quote-style = "double"
indent-style = "space"
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"B", # flake8-bugbear
"LOG", # flake8-logging
"I", # isort
"T20", # flake8-print (replaces S002)
"UP", # pyupgrade
]
ignore = [
"E203", # whitespace before ':' (black compatibility)
"E402", # module level import not at top of file
"E501", # line too long (formatter handles this)
"E731", # do not assign a lambda expression
"B007", # unused loop control variable
"B009", # do not call getattr with a constant attribute value
"B010", # do not call setattr with a constant attribute value
"B011", # do not call assert False (we don't use PYTHONOPTIMIZE)
"B017", # assert-raises-exception (not enforced before)
"B018", # useless-expression (not enforced before)
"B020", # loop variable overwritten by assignment target
"B023", # function definition does not bind loop variable
"B024", # abstract base class with no abstract methods
"B026", # star-arg unpacking after a keyword argument
"B027", # empty method in abstract base class
"B904", # raise-without-from-inside-except (not enforced before)
"B905", # zip-without-explicit-strict (not enforced before)
"B911", # itertools.batched without strict (not enforced before)
"B028", # no explicit stacklevel in warnings (not enforced before)
"B033", # duplicate set items (not enforced before)
"B039", # mutable ContextVar default (not enforced before)
# --- flake8-logging rules not previously enforced ---
"LOG014", # exc-info-outside-except-handler
"LOG015", # root-logger-call
# --- pyupgrade rules to ignore for now ---
"UP007", # use X | Y for union types (fix in future PR)
"UP017", # datetime-utc-alias
"UP031", # printf-string-formatting (fix with f-strings in future PR)
"UP035", # deprecated typing imports (fix in future PR)
"UP040", # use type keyword instead of TypeAlias (fix in future PR)
"UP045", # use X | None instead of Optional (fix in future PR)
"UP046", # non-pep695-generic-class (PEP 695 migration is a larger effort)
"UP047", # non-pep695-generic-function (PEP 695 migration is a larger effort)
]
[tool.ruff.lint.per-file-ignores]
# Allow print statements in specific files (matches S002 ignores)
".github/*" = ["T20"]
"devenv/*.py" = ["T20"]
"src/sentry/build/*" = ["T20"]
"tools/*" = ["T20"]
"**/migrations/*" = ["I"]
[tool.ruff.lint.isort]
known-first-party = ["sentry"]
[tool.pytest.ini_options]
python_files = "test_*.py sentry/testutils/*"
# note: When updating the traceback format, make sure to update .github/pytest.json
addopts = "--tb=short --nomigrations"
# TODO: --import-mode=importlib will become the default soon,
# currently we have a few relative imports that don't work with that.
markers = [
"snuba: test requires access to snuba",
"snuba_ci: test is run in snuba ci",
"sentry_metrics: test requires access to sentry metrics",
"symbolicator: test requires access to symbolicator",
"querybuilder: smoke tests for QueryBuilders",
"seer_agent_token_matrix: API authentication and permission matrix",
"thread_leak_allowlist: temporarily allow known-issue thread leaks",
]
filterwarnings = [
# Consider all warnings to be errors other than the ignored ones.
"error",
# TODO: we should fix these, but for now there's a lot
"ignore:datetime.datetime.utcfromtimestamp\\(\\) is deprecated.*",
"ignore:datetime.datetime.utcnow\\(\\) is deprecated.*",
# The following warning filters are for pytest only.
"ignore:.*sentry.digests.backends.dummy.DummyBackend.*:sentry.utils.warnings.UnsupportedBackend",
# pytest has not yet implemented the replacement for this yet
"ignore:The --looponfail command line argument.*",
# `ATTRIBUTE_NAMES` is a constant from the `sentry-conventions` library.
# We don't want to immediately block any sentry-conventions library updates
# with errors on new deprecations, and some code may depend on the value of
# a deprecated constant. But, still report it as a warning so that we're
# informed and can evaluate.
"default:ATTRIBUTE_NAMES\\..* is deprecated.*:DeprecationWarning",
# PyJWT 2.12.0 introduced InsecureKeyLengthWarning for HMAC keys shorter than
# 32 bytes. Tests use short secrets intentionally; production secrets are long enough.
"ignore:.*HMAC key.*below the minimum recommended length.*:jwt.warnings.InsecureKeyLengthWarning",
# DRF 3.18 deprecated the list-based ListSerializer error format; we keep it until
# callers handle the dict format (removed in DRF 3.20).
"ignore:The list-based error format for `ListSerializer` is deprecated.*:PendingDeprecationWarning",
]
looponfailroots = ["src", "tests"]
[tool.mypy]
python_version = "3.13"
num_workers = 5
mypy_path = ["fixtures/stubs-for-mypy"]
plugins = ["pydantic.mypy", "mypy_django_plugin.main", "tools.mypy_helpers.plugin"]
files = ["."]
exclude = ["^.venv/", "^venv/", "^self-hosted/", "^bin/"]
strict = true
# `cast` on an `Any` value adds no safety, so returning `Any` is allowed.
warn_return_any = false
warn_unreachable = true
enable_error_code = ["ignore-without-code", "redundant-self"]
local_partial_types = true # compat with dmypy
[tool.django-stubs]
django_settings_module = "sentry.conf.server_mypy"
strict_model_abstract_attrs = false
# these have py.typed but incorrect types
[[tool.mypy.overrides]]
module = [
# TODO: these cause type errors when followed
"snuba_sdk.*",
]
follow_imports = "skip"
# python3 -m tools.mypy_helpers.make_stub_ignores
# begin: missing 3rd party stubs
# - add .pyi files to fixtures/stubs-for-mypy
# - or find a 3rd party stub
[[tool.mypy.overrides]]
module = [
"asyncpg.*",
"boto3.*",
"botocore.client.*",
"botocore.exceptions.*",
"cssselect.*",
"django_zero_downtime_migrations.backends.postgres.schema.*",
"emmett55.*",
"emmett_prometheus.*",
"emmett_sentry.*",
"fido2.*",
"google.auth.*",
"google.cloud.*",
"google.resumable_media.common.*",
"google.type.*",
"onelogin.saml2.auth.*",
"onelogin.saml2.constants.*",
"onelogin.saml2.idp_metadata_parser.*",
"pymemcache.*",
"statsd.*",
"tokenizers.*",
"u2flib_server.model.*",
]
ignore_missing_imports = true
# end: missing 3rd party stubs