Skip to content

Commit 16d3d77

Browse files
committed
chore: Move mypy to uv
1 parent ad243c4 commit 16d3d77

11 files changed

Lines changed: 1382 additions & 111 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,22 @@ jobs:
2828

2929
steps:
3030
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
31-
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
3233
with:
3334
python-version: 3.14
34-
- uses: astral-sh/setup-uv@v5
3535

36-
- run: |
37-
uv run ruff check tests sentry_sdk
38-
uv run ruff format --check tests sentry_sdk
39-
uv run tox -e linters
36+
- name: Ruff check
37+
run: uv run ruff check tests sentry_sdk
38+
39+
- name: Ruff format
40+
run: uv run ruff format --check tests sentry_sdk
41+
42+
- name: Linters
43+
run: uv run tox -e linters
44+
45+
- name: Mypy
46+
run: uv run --group typing mypy sentry_sdk
4047

4148
build_lambda_layer:
4249
name: Build Package

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Use **tox** for testing (not pytest directly):
1616

1717
## Type Checking
1818

19-
Use **tox** for type checking (not mypy directly):
20-
- Run `uv run tox -e mypy` before committing (must pass with zero errors)
19+
Mypy and its type stubs live in the opt-in `typing` dependency group:
20+
- Run `uv run --group typing mypy sentry_sdk` before committing (must pass with zero errors)
2121
- Strict mode enabled (`check_untyped_defs`, `disallow_untyped_defs`)
2222

2323
## Linting & Formatting

pyproject.toml

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#
2-
# Project dev dependencies (PEP 735 `dev` group, installed by default).
2+
# Project dev dependencies (PEP 735 groups).
3+
# `dev` is installed by default; `typing` is opt-in via `uv run --group typing`.
34
# Run tox with: `uv run tox -e <env>`
5+
# Run mypy with: `uv run --group typing mypy sentry_sdk`
46
#
57

68
[dependency-groups]
@@ -12,6 +14,34 @@ dev = [
1214
"ruff",
1315
]
1416

17+
typing = [
18+
"mypy",
19+
# =================
20+
# TODO: remove redundant urllib3 and certifi after proper migration from setup.py
21+
"urllib3>=1.26.11",
22+
"certifi",
23+
# =================
24+
"types-protobuf",
25+
"types-gevent",
26+
"types-greenlet",
27+
"types-redis",
28+
"types-setuptools<71",
29+
"types-webob",
30+
"opentelemetry-distro[otlp]",
31+
"pymongo",
32+
"loguru",
33+
"httpcore[asyncio,http2]",
34+
"launchdarkly-server-sdk",
35+
"openfeature-sdk",
36+
"statsig",
37+
"UnleashClient<6",
38+
"typer",
39+
"strawberry-graphql",
40+
"httpx",
41+
"botocore-stubs",
42+
"werkzeug<2.3.0",
43+
]
44+
1545
#
1646
# Tool: Coverage
1747
#
@@ -81,14 +111,6 @@ ignore_missing_imports = true
81111
module = "pyramid.*"
82112
ignore_missing_imports = true
83113

84-
[[tool.mypy.overrides]]
85-
module = "psycopg2.*"
86-
ignore_missing_imports = true
87-
88-
[[tool.mypy.overrides]]
89-
module = "pytest.*"
90-
ignore_missing_imports = true
91-
92114
[[tool.mypy.overrides]]
93115
module = "aiohttp.*"
94116
ignore_missing_imports = true
@@ -105,10 +127,6 @@ ignore_missing_imports = true
105127
module = "tornado.*"
106128
ignore_missing_imports = true
107129

108-
[[tool.mypy.overrides]]
109-
module = "fakeredis.*"
110-
ignore_missing_imports = true
111-
112130
[[tool.mypy.overrides]]
113131
module = "rq.*"
114132
ignore_missing_imports = true
@@ -117,10 +135,6 @@ ignore_missing_imports = true
117135
module = "pyspark.*"
118136
ignore_missing_imports = true
119137

120-
[[tool.mypy.overrides]]
121-
module = "asgiref.*"
122-
ignore_missing_imports = true
123-
124138
[[tool.mypy.overrides]]
125139
module = "langchain_core.*"
126140
ignore_missing_imports = true

requirements-linting.txt

Lines changed: 0 additions & 22 deletions
This file was deleted.

scripts/populate_tox/package_dependencies.jsonl

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/populate_tox/releases.jsonl

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/populate_tox/tox.jinja

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,6 @@ deps =
7777
# with the -r flag
7878
-r requirements-testing.txt
7979

80-
linters: -r requirements-linting.txt
81-
linters: werkzeug<2.3.0
82-
linters: httpcore[asyncio]
83-
84-
mypy: -r requirements-linting.txt
85-
mypy: werkzeug<2.3.0
86-
mypy: httpcore[asyncio]
87-
8880
# === Common ===
8981
py3.8-common: hypothesis
9082
common: pytest-asyncio
@@ -241,10 +233,7 @@ basepython =
241233
py3.14t: python3.14t
242234
243235
# Python version is pinned here for consistency across environments.
244-
# Tools like ruff and mypy have options that pin the target Python
245-
# version (configured in pyproject.toml), ensuring consistent behavior.
246236
linters: python3.14
247-
mypy: python3.14
248237
249238
commands =
250239
; Running `pytest` as an executable suffers from an import error
@@ -254,9 +243,4 @@ commands =
254243
255244
[testenv:linters]
256245
commands =
257-
mypy sentry_sdk
258246
python scripts/find_raise_from_none.py
259-
260-
[testenv:mypy]
261-
commands =
262-
mypy sentry_sdk

scripts/split_tox_gh_actions/templates/test_group.jinja

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5959
- name: Install uv
6060
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
61+
with:
62+
cache-suffix: {% raw %}${{ github.workflow }}-${{ matrix.python-version }}{% endraw %}
6163

6264
{% if needs_clickhouse %}
6365
- name: "Setup ClickHouse Server"

sentry_sdk/integrations/pure_eval.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ def start(n: "ast.expr") -> "Tuple[int, int]":
111111
return (n.lineno, n.col_offset)
112112

113113
nodes_before_stmt = [
114-
node
115-
for node in nodes
116-
if start(node) < stmt.last_token.end # type: ignore
114+
node for node in nodes if start(node) < stmt.last_token.end
117115
]
118116
if nodes_before_stmt:
119117
# The position of the last node before or in the statement

tox.ini

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ envlist =
146146
{py3.6,py3.7,py3.8}-boto3-v1.16.63
147147
{py3.7,py3.10,py3.11}-boto3-v1.24.96
148148
{py3.8,py3.12,py3.13}-boto3-v1.35.99
149-
{py3.10,py3.13,py3.14,py3.14t}-boto3-v1.43.15
149+
{py3.10,py3.13,py3.14,py3.14t}-boto3-v1.43.16
150150
{py3.10,py3.13,py3.14,py3.14t}-boto3-latest
151151

152152
{py3.6,py3.7,py3.8}-chalice-v1.16.0
@@ -305,7 +305,7 @@ envlist =
305305

306306
{py3.6,py3.9,py3.10}-starlette-v0.16.0
307307
{py3.10,py3.13,py3.14,py3.14t}-starlette-v0.52.1
308-
{py3.10,py3.13,py3.14,py3.14t}-starlette-v1.1.0
308+
{py3.10,py3.13,py3.14,py3.14t}-starlette-v1.2.0
309309
{py3.10,py3.13,py3.14,py3.14t}-starlette-latest
310310

311311
{py3.6,py3.9,py3.10}-fastapi-v0.79.1
@@ -393,14 +393,6 @@ deps =
393393
# with the -r flag
394394
-r requirements-testing.txt
395395

396-
linters: -r requirements-linting.txt
397-
linters: werkzeug<2.3.0
398-
linters: httpcore[asyncio]
399-
400-
mypy: -r requirements-linting.txt
401-
mypy: werkzeug<2.3.0
402-
mypy: httpcore[asyncio]
403-
404396
# === Common ===
405397
py3.8-common: hypothesis
406398
common: pytest-asyncio
@@ -584,8 +576,8 @@ deps =
584576
boto3-v1.16.63: boto3==1.16.63
585577
boto3-v1.24.96: boto3==1.24.96
586578
boto3-v1.35.99: boto3==1.35.99
587-
boto3-v1.43.15: boto3==1.43.15
588-
boto3-latest: boto3==1.43.15
579+
boto3-v1.43.16: boto3==1.43.16
580+
boto3-latest: boto3==1.43.16
589581
{py3.7,py3.8}-boto3: urllib3<2.0.0
590582

591583
chalice-v1.16.0: chalice==1.16.0
@@ -828,8 +820,8 @@ deps =
828820

829821
starlette-v0.16.0: starlette==0.16.0
830822
starlette-v0.52.1: starlette==0.52.1
831-
starlette-v1.1.0: starlette==1.1.0
832-
starlette-latest: starlette==1.1.0
823+
starlette-v1.2.0: starlette==1.2.0
824+
starlette-latest: starlette==1.2.0
833825
starlette: pytest-asyncio
834826
starlette: python-multipart
835827
starlette: requests
@@ -1099,10 +1091,7 @@ basepython =
10991091
py3.14t: python3.14t
11001092

11011093
# Python version is pinned here for consistency across environments.
1102-
# Tools like mypy have options that pin the target Python
1103-
# version (configured in pyproject.toml), ensuring consistent behavior.
11041094
linters: python3.14
1105-
mypy: python3.14
11061095

11071096
commands =
11081097
; Running `pytest` as an executable suffers from an import error
@@ -1112,9 +1101,4 @@ commands =
11121101

11131102
[testenv:linters]
11141103
commands =
1115-
mypy sentry_sdk
11161104
python scripts/find_raise_from_none.py
1117-
1118-
[testenv:mypy]
1119-
commands =
1120-
mypy sentry_sdk

0 commit comments

Comments
 (0)