Skip to content

Commit 5e18c7c

Browse files
committed
chore: Move mypy to uv
1 parent 07280c2 commit 5e18c7c

12 files changed

Lines changed: 1383 additions & 111 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.jsonl -diff linguist-generated=true
2+
uv.lock -diff linguist-generated=true

.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

0 commit comments

Comments
 (0)