[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.132.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.0b1", "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", "tiktoken>=0.8.0", "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-cli>=3.3.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.rpc.status_pb2.*", "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