Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ad96829

Browse files
authored
Remove linters from requirements-tests.txt (#12725)
1 parent 77510ae commit ad96829

4 files changed

Lines changed: 13 additions & 17 deletions

File tree

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.6.0 # must match requirements-tests.txt
3+
rev: v4.6.0
44
hooks:
55
- id: trailing-whitespace
66
- id: end-of-file-fixer
@@ -27,16 +27,16 @@ repos:
2727
- "--unsafe-fixes"
2828
files: '.*test_cases/.+\.py$'
2929
- repo: https://github.com/psf/black-pre-commit-mirror
30-
rev: 24.8.0 # must match requirements-tests.txt
30+
rev: 24.8.0
3131
hooks:
3232
- id: black
3333
- repo: https://github.com/pycqa/flake8
34-
rev: 7.1.1 # must match requirements-tests.txt
34+
rev: 7.1.1
3535
hooks:
3636
- id: flake8
3737
additional_dependencies:
38-
- "flake8-noqa==1.4.0" # must match requirements-tests.txt
39-
- "flake8-pyi==24.6.0" # must match requirements-tests.txt
38+
- "flake8-noqa==1.4.0"
39+
- "flake8-pyi==24.6.0"
4040
types: [file]
4141
types_or: [python, pyi]
4242
- repo: meta

requirements-tests.txt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
# Type checkers and other linters that we test our stubs against. These should always
2-
# be pinned to a specific version to make failure reproducible. See also the
3-
# "tool.typeshed" section in pyproject.toml for additional type checkers.
4-
black==24.8.0 # must match .pre-commit-config.yaml
5-
flake8==7.1.1 # must match .pre-commit-config.yaml
6-
flake8-noqa==1.4.0 # must match .pre-commit-config.yaml
7-
flake8-pyi==24.6.0 # must match .pre-commit-config.yaml
1+
# Type checkers that we test our stubs against. These should always
2+
# be pinned to a specific version to make failure reproducible.
83
mypy==1.11.2
9-
pre-commit-hooks==4.6.0 # must match .pre-commit-config.yaml
104
pyright==1.1.383
115
# pytype can be installed on Windows, but requires building wheels, let's not do that on the CI
126
pytype==2024.9.13; platform_system != "Windows" and python_version < "3.13"
13-
ruff==0.6.8 # must match .pre-commit-config.yaml
147

158
# Libraries used by our various scripts.
169
aiohttp==3.10.8
@@ -21,6 +14,8 @@ mypy-protobuf==3.6.0
2114
packaging==24.1
2215
pathspec>=0.11.1
2316
pre-commit
17+
# Required by create_baseline_stubs.py. Must match .pre-commit-config.yaml.
18+
ruff==0.6.8
2419
stubdefaulter==0.1.0
2520
termcolor>=2.3
2621
tomli==2.0.1

scripts/create_baseline_stubs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
import argparse
1414
import asyncio
15-
import os
15+
import glob
16+
import os.path
1617
import re
1718
import subprocess
1819
import sys
@@ -60,7 +61,7 @@ def run_stubdefaulter(stub_dir: str) -> None:
6061

6162
def run_black(stub_dir: str) -> None:
6263
print(f"Running Black: black {stub_dir}")
63-
subprocess.run(["black", stub_dir])
64+
subprocess.run(["pre-commit", "run", "black", "--files", *glob.iglob(f"{stub_dir}/**/*.pyi")])
6465

6566

6667
def run_ruff(stub_dir: str) -> None:

tests/check_typeshed_structure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
# These type checkers and linters must have exact versions in the requirements file to ensure
3232
# consistent CI runs.
33-
linters = {"black", "flake8", "flake8-noqa", "flake8-pyi", "mypy", "pyright", "pytype", "ruff"}
33+
linters = {"mypy", "pyright", "pytype", "ruff"}
3434

3535

3636
def assert_consistent_filetypes(

0 commit comments

Comments
 (0)