Skip to content

Commit 07280c2

Browse files
committed
chore: Move ruff completely to uv (#6430)
this will **finally** make pre-commit consistent with CI :upside_down_face:
1 parent bb5d843 commit 07280c2

8 files changed

Lines changed: 49 additions & 27 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ jobs:
3131
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
3232
with:
3333
python-version: 3.14
34+
- uses: astral-sh/setup-uv@v5
3435

3536
- run: |
36-
pip install tox
37-
tox -e linters
37+
uv run ruff check tests sentry_sdk
38+
uv run ruff format --check tests sentry_sdk
39+
uv run tox -e linters
3840
3941
build_lambda_layer:
4042
name: Build Package

.pre-commit-config.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
- repo: https://github.com/astral-sh/ruff-pre-commit
5-
rev: v0.13.2
4+
- repo: local
65
hooks:
76
- id: ruff-check
8-
args: [--fix]
7+
name: ruff check
8+
entry: uv run ruff check --force-exclude --fix
9+
language: system
10+
types_or: [python, pyi]
11+
require_serial: true
912
- id: ruff-format
13+
name: ruff format
14+
entry: uv run ruff format --force-exclude
15+
language: system
16+
types_or: [python, pyi]
17+
require_serial: true

AGENTS.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ Use **tox** for type checking (not mypy directly):
2222

2323
## Linting & Formatting
2424

25-
Use **tox** for linting (not ruff directly):
26-
- `uv run tox -e ruff`
25+
Use **ruff** for linting and formatting:
26+
- `uv run ruff check --fix tests sentry_sdk`
27+
- `uv run ruff format tests sentry_sdk`
28+
29+
30+
Use **tox** for running the other linting steps:
2731
- Full lint suite: `uv run tox -e linters`
2832
- Full lint suite must pass before committing
2933

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dev = [
99
"tox-uv",
1010
"coverage[toml]",
1111
"pre-commit",
12+
"ruff",
1213
]
1314

1415
#

requirements-linting.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
mypy
2-
ruff
32
types-certifi
43
types-protobuf
54
types-gevent

scripts/populate_tox/tox.jinja

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ deps =
8484
mypy: -r requirements-linting.txt
8585
mypy: werkzeug<2.3.0
8686
mypy: httpcore[asyncio]
87-
ruff: -r requirements-linting.txt
8887

8988
# === Common ===
9089
py3.8-common: hypothesis
@@ -246,7 +245,6 @@ basepython =
246245
# version (configured in pyproject.toml), ensuring consistent behavior.
247246
linters: python3.14
248247
mypy: python3.14
249-
ruff: python3.14
250248
251249
commands =
252250
; Running `pytest` as an executable suffers from an import error
@@ -256,16 +254,9 @@ commands =
256254
257255
[testenv:linters]
258256
commands =
259-
ruff check tests sentry_sdk
260-
ruff format --check tests sentry_sdk
261257
mypy sentry_sdk
262258
python scripts/find_raise_from_none.py
263259
264260
[testenv:mypy]
265261
commands =
266262
mypy sentry_sdk
267-
268-
[testenv:ruff]
269-
commands =
270-
ruff check tests sentry_sdk
271-
ruff format --check tests sentry_sdk

tox.ini

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ deps =
400400
mypy: -r requirements-linting.txt
401401
mypy: werkzeug<2.3.0
402402
mypy: httpcore[asyncio]
403-
ruff: -r requirements-linting.txt
404403

405404
# === Common ===
406405
py3.8-common: hypothesis
@@ -1100,11 +1099,10 @@ basepython =
11001099
py3.14t: python3.14t
11011100

11021101
# Python version is pinned here for consistency across environments.
1103-
# Tools like ruff and mypy have options that pin the target Python
1102+
# Tools like mypy have options that pin the target Python
11041103
# version (configured in pyproject.toml), ensuring consistent behavior.
11051104
linters: python3.14
11061105
mypy: python3.14
1107-
ruff: python3.14
11081106

11091107
commands =
11101108
; Running `pytest` as an executable suffers from an import error
@@ -1114,16 +1112,9 @@ commands =
11141112

11151113
[testenv:linters]
11161114
commands =
1117-
ruff check tests sentry_sdk
1118-
ruff format --check tests sentry_sdk
11191115
mypy sentry_sdk
11201116
python scripts/find_raise_from_none.py
11211117

11221118
[testenv:mypy]
11231119
commands =
11241120
mypy sentry_sdk
1125-
1126-
[testenv:ruff]
1127-
commands =
1128-
ruff check tests sentry_sdk
1129-
ruff format --check tests sentry_sdk

uv.lock

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

0 commit comments

Comments
 (0)