Skip to content

Commit

Permalink
Remove linters from requirements-tests.txt (#12725)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood authored Oct 5, 2024
1 parent 77510ae commit ad96829
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0 # must match requirements-tests.txt
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -27,16 +27,16 @@ repos:
- "--unsafe-fixes"
files: '.*test_cases/.+\.py$'
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.8.0 # must match requirements-tests.txt
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 7.1.1 # must match requirements-tests.txt
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies:
- "flake8-noqa==1.4.0" # must match requirements-tests.txt
- "flake8-pyi==24.6.0" # must match requirements-tests.txt
- "flake8-noqa==1.4.0"
- "flake8-pyi==24.6.0"
types: [file]
types_or: [python, pyi]
- repo: meta
Expand Down
13 changes: 4 additions & 9 deletions requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
# Type checkers and other linters that we test our stubs against. These should always
# be pinned to a specific version to make failure reproducible. See also the
# "tool.typeshed" section in pyproject.toml for additional type checkers.
black==24.8.0 # must match .pre-commit-config.yaml
flake8==7.1.1 # must match .pre-commit-config.yaml
flake8-noqa==1.4.0 # must match .pre-commit-config.yaml
flake8-pyi==24.6.0 # must match .pre-commit-config.yaml
# Type checkers that we test our stubs against. These should always
# be pinned to a specific version to make failure reproducible.
mypy==1.11.2
pre-commit-hooks==4.6.0 # must match .pre-commit-config.yaml
pyright==1.1.383
# pytype can be installed on Windows, but requires building wheels, let's not do that on the CI
pytype==2024.9.13; platform_system != "Windows" and python_version < "3.13"
ruff==0.6.8 # must match .pre-commit-config.yaml

# Libraries used by our various scripts.
aiohttp==3.10.8
Expand All @@ -21,6 +14,8 @@ mypy-protobuf==3.6.0
packaging==24.1
pathspec>=0.11.1
pre-commit
# Required by create_baseline_stubs.py. Must match .pre-commit-config.yaml.
ruff==0.6.8
stubdefaulter==0.1.0
termcolor>=2.3
tomli==2.0.1
Expand Down
5 changes: 3 additions & 2 deletions scripts/create_baseline_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

import argparse
import asyncio
import os
import glob
import os.path
import re
import subprocess
import sys
Expand Down Expand Up @@ -60,7 +61,7 @@ def run_stubdefaulter(stub_dir: str) -> None:

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


def run_ruff(stub_dir: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/check_typeshed_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

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


def assert_consistent_filetypes(
Expand Down

0 comments on commit ad96829

Please sign in to comment.