| 1 |
minimum_pre_commit_version: "4.4.0" |
| 2 |
repos: |
| 3 |
- repo: https://github.com/astral-sh/ruff-pre-commit |
| 4 |
rev: "v0.15.16" |
| 5 |
hooks: |
| 6 |
- id: ruff-check |
| 7 |
args: ["--fix"] |
| 8 |
- id: ruff-format |
| 9 |
- repo: https://github.com/pre-commit/pre-commit-hooks |
| 10 |
rev: v6.0.0 |
| 11 |
hooks: |
| 12 |
- id: trailing-whitespace |
| 13 |
- id: end-of-file-fixer |
| 14 |
- id: check-yaml |
| 15 |
- repo: https://github.com/woodruffw/zizmor-pre-commit |
| 16 |
rev: v1.25.2 |
| 17 |
hooks: |
| 18 |
- id: zizmor |
| 19 |
args: ["--fix", "--no-progress"] |
| 20 |
- repo: https://github.com/adamchainz/blacken-docs |
| 21 |
rev: 1.20.0 |
| 22 |
hooks: |
| 23 |
- id: blacken-docs |
| 24 |
additional_dependencies: [black==24.1.1] |
| 25 |
- repo: https://github.com/codespell-project/codespell |
| 26 |
rev: v2.4.2 |
| 27 |
hooks: |
| 28 |
- id: codespell |
| 29 |
args: ["--toml=pyproject.toml"] |
| 30 |
additional_dependencies: |
| 31 |
- tomli |
| 32 |
- repo: https://github.com/pre-commit/pygrep-hooks |
| 33 |
rev: v1.10.0 |
| 34 |
hooks: |
| 35 |
- id: python-use-type-annotations |
| 36 |
- repo: https://github.com/pre-commit/mirrors-mypy |
| 37 |
rev: v2.1.0 |
| 38 |
hooks: |
| 39 |
- id: mypy |
| 40 |
files: ^(src/|testing/|scripts/) |
| 41 |
additional_dependencies: |
| 42 |
- iniconfig>=1.1.0 |
| 43 |
- attrs>=19.2.0 |
| 44 |
- pluggy>=1.5.0 |
| 45 |
- packaging |
| 46 |
- tomli |
| 47 |
- types-setuptools |
| 48 |
- types-tabulate |
| 49 |
# for mypy running on python>=3.11 since exceptiongroup is only a dependency |
| 50 |
# on <3.11 |
| 51 |
- exceptiongroup>=1.0.0rc8 |
| 52 |
- repo: https://github.com/RobertCraigie/pyright-python |
| 53 |
rev: v1.1.410 |
| 54 |
hooks: |
| 55 |
- id: pyright |
| 56 |
files: ^(src/|scripts/) |
| 57 |
additional_dependencies: |
| 58 |
- iniconfig>=1.1.0 |
| 59 |
- attrs>=19.2.0 |
| 60 |
- pluggy>=1.5.0 |
| 61 |
- packaging |
| 62 |
- tomli |
| 63 |
- types-setuptools |
| 64 |
- types-tabulate |
| 65 |
# for mypy running on python>=3.11 since exceptiongroup is only a dependency |
| 66 |
# on <3.11 |
| 67 |
- exceptiongroup>=1.0.0rc8 |
| 68 |
# Manual because passing pyright is a work in progress. |
| 69 |
stages: [manual] |
| 70 |
- repo: https://github.com/pytest-dev/pyproject-fmt |
| 71 |
rev: "v2.12.1" |
| 72 |
hooks: |
| 73 |
- id: pyproject-fmt |
| 74 |
# https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version |
| 75 |
additional_dependencies: ["tox>=4.9"] |
| 76 |
- repo: https://github.com/asottile/pyupgrade |
| 77 |
rev: v3.21.2 |
| 78 |
hooks: |
| 79 |
- id: pyupgrade |
| 80 |
args: |
| 81 |
- "--py310-plus" |
| 82 |
# Manual because ruff does what pyupgrade does and the two are not out of sync |
| 83 |
# often enough to make launching pyupgrade everytime worth it |
| 84 |
stages: [manual] |
| 85 |
- repo: local |
| 86 |
hooks: |
| 87 |
- id: pylint |
| 88 |
name: pylint |
| 89 |
entry: pylint |
| 90 |
language: unsupported |
| 91 |
types: [python] |
| 92 |
args: ["-rn", "-sn", "--fail-on=I", "--enable-all-extentions"] |
| 93 |
require_serial: true |
| 94 |
stages: [manual] |
| 95 |
- id: rst |
| 96 |
name: rst |
| 97 |
entry: rst-lint |
| 98 |
files: ^(RELEASING.rst|README.rst|TIDELIFT.rst)$ |
| 99 |
language: python |
| 100 |
additional_dependencies: [pygments, restructuredtext_lint>=2.0.0] |
| 101 |
- id: changelogs-rst |
| 102 |
name: changelog filenames |
| 103 |
language: fail |
| 104 |
entry: >- |
| 105 |
changelog files must be named |
| 106 |
####.( |
| 107 |
breaking |
| 108 |
| deprecation |
| 109 |
| feature |
| 110 |
| improvement |
| 111 |
| bugfix |
| 112 |
| vendor |
| 113 |
| doc |
| 114 |
| packaging |
| 115 |
| contrib |
| 116 |
| misc |
| 117 |
)(.#)?(.rst)? |
| 118 |
exclude: >- |
| 119 |
(?x) |
| 120 |
^ |
| 121 |
changelog/( |
| 122 |
\.gitignore |
| 123 |
|\d+\.( |
| 124 |
breaking |
| 125 |
|deprecation |
| 126 |
|feature |
| 127 |
|improvement |
| 128 |
|bugfix |
| 129 |
|vendor |
| 130 |
|doc |
| 131 |
|packaging |
| 132 |
|contrib |
| 133 |
|misc |
| 134 |
)(\.\d+)?(\.rst)? |
| 135 |
|README\.rst |
| 136 |
|_template\.rst |
| 137 |
) |
| 138 |
$ |
| 139 |
files: ^changelog/ |
| 140 |
- id: changelogs-user-role |
| 141 |
name: Changelog files should use a non-broken :user:`name` role |
| 142 |
language: pygrep |
| 143 |
entry: :user:([^`]+`?|`[^`]+[\s,]) |
| 144 |
pass_filenames: true |
| 145 |
types: |
| 146 |
- file |
| 147 |
- rst |
| 148 |
- id: py-deprecated |
| 149 |
name: py library is deprecated |
| 150 |
language: pygrep |
| 151 |
entry: > |
| 152 |
(?x)\bpy\.( |
| 153 |
_code\.| |
| 154 |
builtin\.| |
| 155 |
code\.| |
| 156 |
io\.| |
| 157 |
path\.local\.sysfind| |
| 158 |
process\.| |
| 159 |
std\.| |
| 160 |
error\.| |
| 161 |
xml\. |
| 162 |
) |
| 163 |
types: [python] |
| 164 |
- id: py-path-deprecated |
| 165 |
name: py.path usage is deprecated |
| 166 |
exclude: docs|src/_pytest/deprecated.py|testing/deprecated_test.py|src/_pytest/legacypath.py |
| 167 |
language: pygrep |
| 168 |
entry: \bpy\.path\.local |
| 169 |
types: [python] |