diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 066233a85dc2..51eb7208b505 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,13 +9,6 @@ repos: - id: check-merge-conflict - id: mixed-line-ending - id: check-case-conflict - - repo: https://github.com/hadialqattan/pycln - rev: v2.1.6 # must match requirements-tests.txt - hooks: - - id: pycln - args: [--config=pyproject.toml] - types: [file] - types_or: [python, pyi] - repo: https://github.com/psf/black rev: 23.7.0 # must match requirements-tests.txt hooks: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5fd6b091d0a1..fb2db8d321e7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,7 +29,7 @@ it takes a bit longer. For more details, read below. Typeshed runs continuous integration (CI) on all pull requests. This means that if you file a pull request (PR), our full test suite -- including our linter, `flake8` -- is run on your PR. It also means that bots will automatically apply -changes to your PR (using `pycln`, `black`, `isort` and `ruff`) to fix any formatting issues. +changes to your PR (using `black`, `isort` and `ruff`) to fix any formatting issues. This frees you up to ignore all local setup on your side, focus on the code and rely on the CI to fix everything, or point you to the places that need fixing. @@ -84,8 +84,8 @@ terminal to install all non-pytype requirements: ## Code formatting -The code is formatted using `black` and `isort`. Unused imports are also -auto-removed using `pycln`, and various other autofixes are performed by `ruff`. +The code is formatted using `black` and `isort`. Various other autofixes are +also performed by `ruff`. The repository is equipped with a [`pre-commit.ci`](https://pre-commit.ci/) configuration file. This means that you don't *need* to do anything yourself to @@ -93,10 +93,9 @@ run the code formatters. When you push a commit, a bot will run those for you right away and add a commit to your PR. That being said, if you *want* to run the checks locally when you commit, -you're free to do so. Either run `pycln`, `isort`, `black` and `ruff` manually... +you're free to do so. Either run `isort`, `black` and `ruff` manually... ```bash -$ pycln --config=pyproject.toml . $ isort . $ ruff . $ black . diff --git a/pyproject.toml b/pyproject.toml index 41d304e2f18a..9bd5a5414702 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,6 +78,7 @@ exclude = [ # Only enable rules that have safe autofixes; # only enable rules that are relevant to stubs select = [ + "F401", # Remove unused imports "UP004", # Remove explicit `object` inheritance "UP006", # PEP-585 autofixes "UP007", # PEP-604 autofixes @@ -95,9 +96,5 @@ select = [ "PYI032", # use `object`, not `Any`, as the second parameter to `__eq__` ] -[tool.pycln] -all = true -disable_all_dunder_policy = true - [tool.typeshed] pyright_version = "1.1.318" diff --git a/requirements-tests.txt b/requirements-tests.txt index 7e9db9c6b2c1..53803e309602 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -9,7 +9,6 @@ flake8-pyi==23.6.0; python_version >= "3.8" # must match .pre-commit-confi isort==5.12.0; python_version >= "3.8" # must match .pre-commit-config.yaml mypy==1.4.1 pre-commit-hooks==4.4.0 # must match .pre-commit-config.yaml -pycln==2.1.6 # must match .pre-commit-config.yaml pytype==2023.6.16; platform_system != "Windows" and python_version < "3.11" ruff==0.0.278 # must match .pre-commit-config.yaml diff --git a/scripts/runtests.py b/scripts/runtests.py index 001e4eff7e5c..ef807dae000f 100644 --- a/scripts/runtests.py +++ b/scripts/runtests.py @@ -75,8 +75,6 @@ def main() -> None: pytype_result: subprocess.CompletedProcess[bytes] | None = None # Run formatters first. Order matters. - print("\nRunning pycln...") - subprocess.run([sys.executable, "-m", "pycln", path, "--config=pyproject.toml"]) print("\nRunning ruff...") subprocess.run([sys.executable, "-m", "ruff", path]) print("\nRunning isort...") diff --git a/tests/check_consistent.py b/tests/check_consistent.py index 9eb8ffb26f12..a820c44275d7 100755 --- a/tests/check_consistent.py +++ b/tests/check_consistent.py @@ -23,7 +23,7 @@ # These type checkers and linters must have exact versions in the requirements file to ensure # consistent CI runs. -linters = {"black", "flake8", "flake8-bugbear", "flake8-noqa", "flake8-pyi", "isort", "ruff", "mypy", "pycln", "pytype"} +linters = {"black", "flake8", "flake8-bugbear", "flake8-noqa", "flake8-pyi", "isort", "ruff", "mypy", "pytype"} def assert_consistent_filetypes(