Skip to content

Commit 86f60a0

Browse files
authored
pre-commit markdown-it-py<3 (for Python 3.7 compatibility) (#4704)
* markdown-it-py dropped Python 3.7 support, but we are type checking for Python 3.7 from a newer version of Python. Keep using markdown-it-py<3 as long as we support Python 3.7. * Shuffle order of pre-commit checks for better agility.
1 parent 0e43fcc commit 86f60a0

File tree

1 file changed

+47
-44
lines changed

1 file changed

+47
-44
lines changed

.pre-commit-config.yaml

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,48 @@ ci:
2222
exclude: ^tools/JoinPaths.cmake$
2323

2424
repos:
25+
26+
# Clang format the codebase automatically
27+
- repo: https://github.com/pre-commit/mirrors-clang-format
28+
rev: "v16.0.4"
29+
hooks:
30+
- id: clang-format
31+
types_or: [c++, c, cuda]
32+
33+
# Black, the code formatter, natively supports pre-commit
34+
- repo: https://github.com/psf/black
35+
rev: "23.3.0" # Keep in sync with blacken-docs
36+
hooks:
37+
- id: black
38+
39+
# Ruff, the Python auto-correcting linter written in Rust
40+
- repo: https://github.com/charliermarsh/ruff-pre-commit
41+
rev: v0.0.270
42+
hooks:
43+
- id: ruff
44+
args: ["--fix", "--show-fixes"]
45+
46+
# Check static types with mypy
47+
- repo: https://github.com/pre-commit/mirrors-mypy
48+
rev: "v1.3.0"
49+
hooks:
50+
- id: mypy
51+
args: []
52+
exclude: ^(tests|docs)/
53+
additional_dependencies:
54+
- markdown-it-py<3 # Drop this together with dropping Python 3.7 support.
55+
- nox
56+
- rich
57+
58+
# CMake formatting
59+
- repo: https://github.com/cheshirekow/cmake-format-precommit
60+
rev: "v0.6.13"
61+
hooks:
62+
- id: cmake-format
63+
additional_dependencies: [pyyaml]
64+
types: [file]
65+
files: (\.cmake|CMakeLists.txt)(.in)?$
66+
2567
# Standard hooks
2668
- repo: https://github.com/pre-commit/pre-commit-hooks
2769
rev: "v4.4.0"
@@ -39,12 +81,6 @@ repos:
3981
- id: requirements-txt-fixer
4082
- id: trailing-whitespace
4183

42-
# Black, the code formatter, natively supports pre-commit
43-
- repo: https://github.com/psf/black
44-
rev: "23.3.0" # Keep in sync with blacken-docs
45-
hooks:
46-
- id: black
47-
4884
# Also code format the docs
4985
- repo: https://github.com/asottile/blacken-docs
5086
rev: "1.13.0"
@@ -66,13 +102,6 @@ repos:
66102
- id: fix-ligatures
67103
- id: fix-smartquotes
68104

69-
# Ruff, the Python auto-correcting linter written in Rust
70-
- repo: https://github.com/charliermarsh/ruff-pre-commit
71-
rev: v0.0.270
72-
hooks:
73-
- id: ruff
74-
args: ["--fix", "--show-fixes"]
75-
76105
# Checking for common mistakes
77106
- repo: https://github.com/pre-commit/pygrep-hooks
78107
rev: "v1.10.0"
@@ -81,32 +110,6 @@ repos:
81110
- id: rst-directive-colons
82111
- id: rst-inline-touching-normal
83112

84-
85-
# PyLint has native support - not always usable, but works for us
86-
- repo: https://github.com/PyCQA/pylint
87-
rev: "v3.0.0a6"
88-
hooks:
89-
- id: pylint
90-
files: ^pybind11
91-
92-
# CMake formatting
93-
- repo: https://github.com/cheshirekow/cmake-format-precommit
94-
rev: "v0.6.13"
95-
hooks:
96-
- id: cmake-format
97-
additional_dependencies: [pyyaml]
98-
types: [file]
99-
files: (\.cmake|CMakeLists.txt)(.in)?$
100-
101-
# Check static types with mypy
102-
- repo: https://github.com/pre-commit/mirrors-mypy
103-
rev: "v1.3.0"
104-
hooks:
105-
- id: mypy
106-
args: []
107-
exclude: ^(tests|docs)/
108-
additional_dependencies: [nox, rich]
109-
110113
# Checks the manifest for missing files (native support)
111114
- repo: https://github.com/mgedmin/check-manifest
112115
rev: "0.49"
@@ -141,9 +144,9 @@ repos:
141144
entry: PyBind|Numpy|Cmake|CCache|PyTest
142145
exclude: ^\.pre-commit-config.yaml$
143146

144-
# Clang format the codebase automatically
145-
- repo: https://github.com/pre-commit/mirrors-clang-format
146-
rev: "v16.0.4"
147+
# PyLint has native support - not always usable, but works for us
148+
- repo: https://github.com/PyCQA/pylint
149+
rev: "v3.0.0a6"
147150
hooks:
148-
- id: clang-format
149-
types_or: [c++, c, cuda]
151+
- id: pylint
152+
files: ^pybind11

0 commit comments

Comments
 (0)