Skip to content

Commit 2ebc690

Browse files
authored
[chore] Remove black and ruff from test-requirements (#18139)
#15210 standardized lint hooks invocations with pre-commit, but did not remove test requirements that became unneeded. Grepping for `ruff` and `black` revealed that they are never used directly any longer except for one outdated README notice. Remove direct dependency on `black` and `ruff`, retaining them only in pre-commit configuration. pre-commit does not use local package installations and manages all virtual environments internally.
1 parent 1ec2ef3 commit 2ebc690

File tree

4 files changed

+14
-24
lines changed

4 files changed

+14
-24
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
exclude: '^(mypyc/external/)|(mypy/typeshed/)|misc/typeshed_patches' # Exclude all vendored code from lints
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.5.0 # must match test-requirements.txt
4+
rev: v4.5.0
55
hooks:
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
88
- repo: https://github.com/psf/black-pre-commit-mirror
9-
rev: 24.8.0 # must match test-requirements.txt
9+
rev: 24.8.0
1010
hooks:
1111
- id: black
1212
exclude: '^(test-data/)'
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.6.9 # must match test-requirements.txt
14+
rev: v0.6.9
1515
hooks:
1616
- id: ruff
1717
args: [--exit-non-zero-on-fix]

test-data/unit/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ First install any additional dependencies needed for testing:
100100

101101
python3 -m pip install -U -r test-requirements.txt
102102

103+
Configure `pre-commit` to run the linters automatically when you commit:
104+
105+
pre-commit install
106+
103107
The unit test suites are driven by the `pytest` framework. To run all mypy tests,
104108
run `pytest` in the mypy repository:
105109

@@ -157,9 +161,11 @@ To run mypy on itself:
157161

158162
python3 -m mypy --config-file mypy_self_check.ini -p mypy
159163

160-
To run the linter:
164+
To run the linter (this commands just wraps `pre-commit`, so you can also
165+
invoke it directly like `pre-commit run -a`, and this will also run when you
166+
`git commit` if enabled):
161167

162-
ruff .
168+
python3 runtests.py lint
163169

164170
You can also run all of the above tests using `runtests.py` (this includes
165171
type checking mypy and linting):

test-requirements.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
-r mypy-requirements.txt
55
-r build-requirements.txt
66
attrs>=18.0
7-
black==24.8.0 # must match version in .pre-commit-config.yaml
87
filelock>=3.3.0
98
# lxml 4.9.3 switched to manylinux_2_28, the wheel builder still uses manylinux2014
109
lxml>=4.9.1,<4.9.3; (python_version<'3.11' or sys_platform!='win32') and python_version<'3.12'
1110
psutil>=4.0
1211
pytest>=8.1.0
1312
pytest-xdist>=1.34.0
1413
pytest-cov>=2.10.0
15-
ruff==0.6.9 # must match version in .pre-commit-config.yaml
1614
setuptools>=75.1.0
1715
tomli>=1.1.0 # needed even on py311+ so the self check passes with --python-version 3.8
1816
pre_commit>=3.5.0

test-requirements.txt

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@
66
#
77
attrs==24.2.0
88
# via -r test-requirements.in
9-
black==24.8.0
10-
# via -r test-requirements.in
119
cfgv==3.4.0
1210
# via pre-commit
13-
click==8.1.7
14-
# via black
1511
coverage==7.6.1
1612
# via pytest-cov
1713
distlib==0.3.9
@@ -29,21 +25,13 @@ iniconfig==2.0.0
2925
lxml==4.9.2 ; (python_version < "3.11" or sys_platform != "win32") and python_version < "3.12"
3026
# via -r test-requirements.in
3127
mypy-extensions==1.0.0
32-
# via
33-
# -r mypy-requirements.txt
34-
# black
28+
# via -r mypy-requirements.txt
3529
nodeenv==1.9.1
3630
# via pre-commit
3731
packaging==24.1
38-
# via
39-
# black
40-
# pytest
41-
pathspec==0.12.1
42-
# via black
32+
# via pytest
4333
platformdirs==4.3.6
44-
# via
45-
# black
46-
# virtualenv
34+
# via virtualenv
4735
pluggy==1.5.0
4836
# via pytest
4937
pre-commit==3.5.0
@@ -61,8 +49,6 @@ pytest-xdist==3.6.1
6149
# via -r test-requirements.in
6250
pyyaml==6.0.2
6351
# via pre-commit
64-
ruff==0.6.9
65-
# via -r test-requirements.in
6652
tomli==2.0.2
6753
# via -r test-requirements.in
6854
types-psutil==6.0.0.20241011

0 commit comments

Comments
 (0)