Skip to content

Commit df8b018

Browse files
authored
chore: pin lint tooling (ruff, pyright, pre-commit) as project-scoped deps (#44)
* chore: run lint hooks via uv run * chore: pin ruff pyright and pre-commit in dev lint group * docs: document uv run and project-scoped tooling
1 parent 8b8f417 commit df8b018

5 files changed

Lines changed: 242 additions & 19 deletions

File tree

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ repos:
33
hooks:
44
- id: ruff-check
55
name: ruff check
6-
entry: uv tool run ruff check --fix
6+
entry: uv run ruff check --fix
77
language: unsupported
88
types: [python]
99

1010
- id: ruff-format
1111
name: ruff format
12-
entry: uv tool run ruff format
12+
entry: uv run ruff format
1313
language: unsupported
1414
types: [python]
1515

1616
- id: pyright
1717
name: pyright
18-
entry: uv tool run pyright src tests
18+
entry: uv run pyright src tests
1919
language: unsupported
2020
types: [python]
2121
pass_filenames: false

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
- Parse Judge0 UTC timestamps as timezone-aware values and validate submission
99
- Replace Flake8 and ufmt checks with pinned Ruff and Pyright hooks.
1010
source code and batch tokens before serialization.
11+
- Pin Ruff, Pyright, and pre-commit as project-scoped dependencies in the dev
12+
`lint` group, replacing global `uv tool` installs for reproducible setups.
1113
- Add `AGENTS.md` and `CHANGELOG.md`

docs/source/contributors_guide/contributing.rst

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,16 @@ Preparing the development setup
1818
1919
$ uv sync --group dev
2020
21-
4. Install the necessary development tools:
21+
4. Install the pre-commit hooks:
2222

2323
.. code-block:: console
2424
25-
$ uv tool install pre-commit
25+
$ uv run pre-commit install
2626
27-
5. Make sure all the necessary tools are installed:
28-
29-
.. code-block:: console
30-
31-
$ uv tool list
32-
33-
6. Finally, install the pre-commit hooks:
34-
35-
.. code-block:: console
36-
37-
$ uv tool run pre-commit install
27+
All project tooling — including the test, documentation, and linting dependencies
28+
(``pytest``, Sphinx, ``ruff``, ``pyright``, and ``pre-commit``) — is project-scoped.
29+
Everything is installed by ``uv sync --group dev`` and invoked with ``uv run``,
30+
so there is no need to install any tools globally.
3831

3932
Building documentation
4033
----------------------
@@ -88,17 +81,23 @@ To run the tests locally, you can use the following command:
8881

8982
.. code-block:: console
9083
91-
$ pytest tests -k '<test_name>'
84+
$ uv run pytest tests -k '<test_name>'
9285
9386
This will enable you to run a single test, without incurring the cost of
9487
running the full test suite. If you want to run the full test suite, you can
9588
use the following command:
9689

9790
.. code-block:: console
9891
99-
$ pytest tests
92+
$ uv run pytest tests
10093
10194
or you can create a draft PR and let the CI pipeline run the tests for you.
10295
The CI pipeline will run the tests on every PR, using a private instance
10396
of Judge0, so you can be sure that your changes are not breaking the existing
10497
functionality.
98+
99+
Before committing, run all linting and type-checking checks with pre-commit:
100+
101+
.. code-block:: console
102+
103+
$ uv run pre-commit run --all-files

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ docs = [
4646
"sphinx-multiversion==0.2.4",
4747
"sphinx-autobuild>=2024.10.3",
4848
]
49-
dev = [{ include-group = "test" }, { include-group = "docs" }]
49+
dev = [{ include-group = "test" }, { include-group = "docs" }, { include-group = "lint" }]
50+
lint = [
51+
"pre-commit==4.6.0",
52+
"pyright==1.1.409",
53+
"ruff==0.15.12",
54+
]
5055

5156

5257
[tool.ruff.lint.per-file-ignores]

0 commit comments

Comments
 (0)