Skip to content

Commit c45f8c4

Browse files
chore(backport): Update pre-commit hooks (#2424)
* Backport: - PR #2378 - PR #2380 - PR #2381 - PR #2382 - PR #2383 - PR #2386 - PR #2412 - PR #2414
1 parent 9c9fc87 commit c45f8c4

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

.pre-commit-config.yaml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44

55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.4.0
7+
rev: v4.5.0
88
hooks:
99
- id: check-added-large-files
1010
- id: check-case-conflict
@@ -22,29 +22,38 @@ repos:
2222
- id: name-tests-test
2323
args: ["--pytest-test-first"]
2424
- id: requirements-txt-fixer
25+
exclude: tests/constraints.txt
2526
- id: trailing-whitespace
2627
# exclude generated files
2728
exclude: ^validation/|\.dtd$|\.xml$
2829

30+
- repo: https://github.com/pre-commit/pygrep-hooks
31+
rev: "v1.10.0"
32+
hooks:
33+
- id: rst-backticks
34+
- id: rst-directive-colons
35+
- id: rst-inline-touching-normal
36+
2937
- repo: https://github.com/astral-sh/ruff-pre-commit
30-
rev: "v0.0.292"
38+
rev: "v0.1.9"
3139
hooks:
3240
- id: ruff
3341
args: ["--fix", "--show-fixes"]
3442

3543
- repo: https://github.com/psf/black-pre-commit-mirror
36-
rev: 23.9.1
44+
rev: 23.12.1
3745
hooks:
3846
- id: black-jupyter
47+
types_or: [python, pyi, jupyter]
3948

4049
- repo: https://github.com/adamchainz/blacken-docs
4150
rev: 1.16.0
4251
hooks:
4352
- id: blacken-docs
44-
additional_dependencies: [black==23.7.0]
53+
additional_dependencies: [black==23.12.1]
4554

4655
- repo: https://github.com/pre-commit/mirrors-mypy
47-
rev: v1.5.1
56+
rev: v1.8.0
4857
# check the oldest and newest supported Pythons
4958
hooks:
5059
- &mypy
@@ -58,13 +67,6 @@ repos:
5867
name: mypy with Python 3.11
5968
args: ["--python-version=3.11"]
6069

61-
- repo: https://github.com/nbQA-dev/nbQA
62-
rev: 1.7.0
63-
hooks:
64-
- id: nbqa-ruff
65-
additional_dependencies: [ruff==0.0.292]
66-
args: ["--extend-ignore=F821,F401,F841,F811"]
67-
6870
- repo: https://github.com/codespell-project/codespell
6971
rev: v2.2.6
7072
hooks:

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. pyhf documentation master file, created by
22
sphinx-quickstart on Fri Feb 9 11:58:49 2018.
33
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
4+
contain the root ``toctree`` directive.
55
66
.. toctree::
77
:hidden:

pyproject.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,15 @@ filterwarnings = [
222222
'ignore:Call to deprecated create function:DeprecationWarning', # protobuf via tensorflow
223223
'ignore:`np.bool8` is a deprecated alias for `np.bool_`:DeprecationWarning', # numpy via tensorflow
224224
"ignore:module 'sre_constants' is deprecated:DeprecationWarning", # tensorflow v2.12.0+ for Python 3.11+
225+
"ignore:ml_dtypes.float8_e4m3b11 is deprecated.", #FIXME: Can remove when jaxlib>=0.4.12
226+
"ignore:Skipping device Apple Paravirtual device that does not support Metal 2.0:UserWarning", # Can't fix given hardware/virtualized device
225227
]
226228

227229
[tool.mypy]
228230
files = "src"
229231
python_version = "3.11"
230232
warn_unused_configs = true
231233
strict = true
232-
show_error_codes = true
233234
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
234235
warn_unreachable = true
235236

@@ -276,25 +277,28 @@ module = [
276277
ignore_errors = true
277278

278279
[tool.ruff]
280+
src = ["src"]
281+
line-length = 88
282+
283+
[tool.ruff.lint]
279284
select = [
280285
"E", "F", "W", # flake8
281286
"UP", # pyupgrade
282287
"RUF", # Ruff-specific
283288
"TID", # flake8-tidy-imports
284289
]
285-
line-length = 88
286290
ignore = [
287291
"E402",
288292
"E501",
289293
"RUF001", # String contains ambiguous unicode character
290294
"RUF005", # unpack-instead-of-concatenating-to-collection-literal
291295
]
292-
src = ["src"]
293296
typing-modules = ["pyhf.typing"]
294297
unfixable = [
295298
"F841", # Removes unused variables
296299
]
297300
flake8-tidy-imports.ban-relative-imports = "all"
298301

299-
[tool.ruff.per-file-ignores]
302+
[tool.ruff.lint.per-file-ignores]
300303
"docs/lite/jupyterlite.py" = ["F401", "F704"]
304+
"**.ipynb" = ["F821", "F401", "F841", "F811", "E703"]

0 commit comments

Comments
 (0)