From e25b1834594874745575f221a056a228042aaff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 24 Jan 2021 15:25:37 +0100 Subject: [PATCH 1/2] Update pre-commit hooks --- .pre-commit-config.yaml | 10 +++++----- src/pip/_internal/locations.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 636fdfd3d..49676b5cf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ exclude: 'src/pip/_vendor/' repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v3.4.0 hooks: - id: check-builtin-literals - id: check-added-large-files @@ -53,7 +53,7 @@ repos: - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.3 + rev: 3.8.4 hooks: - id: flake8 additional_dependencies: [ @@ -63,20 +63,20 @@ repos: exclude: tests/data - repo: https://github.com/PyCQA/isort - rev: 5.5.3 + rev: 5.7.0 hooks: - id: isort files: \.py$ - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.790 + rev: v0.800 hooks: - id: mypy exclude: docs|tests args: ["--pretty"] - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.6.0 + rev: v1.7.0 hooks: - id: python-no-log-warn - id: python-no-eval diff --git a/src/pip/_internal/locations.py b/src/pip/_internal/locations.py index 2a9032977..88b9e43cd 100644 --- a/src/pip/_internal/locations.py +++ b/src/pip/_internal/locations.py @@ -8,7 +8,7 @@ import os.path import site import sys import sysconfig -from distutils.command.install import SCHEME_KEYS # type: ignore +from distutils.command.install import SCHEME_KEYS from distutils.command.install import install as distutils_install_command from pip._internal.models.scheme import Scheme From fe3aec0f5e4a15c4110eb1974497371f26c4fec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 24 Jan 2021 15:39:51 +0100 Subject: [PATCH 2/2] Better way to run slow linters in CI only Taking advantage of pre-commit's manual stage. --- .pre-commit-config-slow.yaml | 7 ------- .pre-commit-config.yaml | 6 ++++++ MANIFEST.in | 1 - noxfile.py | 4 +--- tox.ini | 3 +-- 5 files changed, 8 insertions(+), 13 deletions(-) delete mode 100644 .pre-commit-config-slow.yaml diff --git a/.pre-commit-config-slow.yaml b/.pre-commit-config-slow.yaml deleted file mode 100644 index 2179c6657..000000000 --- a/.pre-commit-config-slow.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# Slow pre-commit checks we don't want to run locally with each commit. - -repos: -- repo: https://github.com/mgedmin/check-manifest - rev: '0.43' - hooks: - - id: check-manifest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 49676b5cf..164de60b0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -93,3 +93,9 @@ repos: entry: NEWS fragment files must be named *.(process|removal|feature|bugfix|vendor|doc|trivial).rst exclude: ^news/(.gitignore|.*\.(process|removal|feature|bugfix|vendor|doc|trivial).rst) files: ^news/ + +- repo: https://github.com/mgedmin/check-manifest + rev: '0.46' + hooks: + - id: check-manifest + stages: [manual] diff --git a/MANIFEST.in b/MANIFEST.in index 2cf636ce3..24d455378 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -17,7 +17,6 @@ exclude .appveyor.yml exclude .travis.yml exclude .readthedocs.yml exclude .pre-commit-config.yaml -exclude .pre-commit-config-slow.yaml exclude tox.ini exclude noxfile.py diff --git a/noxfile.py b/noxfile.py index de4daf8a7..e89e73a8d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -147,11 +147,9 @@ def lint(session): args = session.posargs + ["--all-files"] else: args = ["--all-files", "--show-diff-on-failure"] + args.append("--hook-stage=manual") session.run("pre-commit", "run", *args) - session.run( - "pre-commit", "run", "-c", ".pre-commit-config-slow.yaml", *args - ) @nox.session diff --git a/tox.ini b/tox.ini index 7fcc2c664..79586eba8 100644 --- a/tox.ini +++ b/tox.ini @@ -63,8 +63,7 @@ skip_install = True commands_pre = deps = pre-commit commands = - pre-commit run [] --all-files --show-diff-on-failure - pre-commit run [] -c .pre-commit-config-slow.yaml --all-files --show-diff-on-failure + pre-commit run [] --all-files --show-diff-on-failure --hook-stage=manual [testenv:vendoring] basepython = python3