Skip to content

Commit 1ab4a49

Browse files
Update pre-commit to use ruff
1 parent d50742d commit 1ab4a49

File tree

2 files changed

+49
-38
lines changed

2 files changed

+49
-38
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
3+
rev: v4.6.0
44
hooks:
55
- id: check-merge-conflict
66
- id: check-toml
@@ -10,37 +10,18 @@ repos:
1010
- id: no-commit-to-branch
1111
args: [--branch, main]
1212
- id: trailing-whitespace
13-
- repo: https://github.com/PyCQA/isort
14-
rev: 5.13.2
13+
14+
- repo: https://github.com/astral-sh/ruff-pre-commit
15+
rev: v0.4.8
1516
hooks:
16-
- id: isort
17-
name: isort
18-
- repo: https://github.com/asottile/pyupgrade
19-
rev: v3.15.0
20-
hooks:
21-
- id: pyupgrade
22-
args: [--py37-plus]
23-
- repo: https://github.com/psf/black
24-
rev: 24.1.1
25-
hooks:
26-
- id: black
27-
- id: black-jupyter
28-
- repo: https://github.com/PyCQA/pylint
29-
rev: v3.0.3
30-
hooks:
31-
- id: pylint
32-
args: [--rcfile=.pylintrc]
33-
files: ^pymc_experimental/
17+
- id: ruff
18+
args: [ --fix, --exit-non-zero-on-fix ]
19+
- id: ruff-format
20+
types_or: [ python, pyi, jupyter ]
21+
3422
- repo: https://github.com/MarcoGorelli/madforhooks
3523
rev: 0.4.1
3624
hooks:
3725
- id: no-print-statements
3826
exclude: _version.py
3927
files: ^pymc_experimental/
40-
- repo: local
41-
hooks:
42-
- id: no-relative-imports
43-
name: No relative imports
44-
entry: from \.[\.\w]* import
45-
types: [python]
46-
language: pygrep

pyproject.toml

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,51 @@ filterwarnings =[
2222
'ignore:jax\.tree_map is deprecated:DeprecationWarning',
2323
]
2424

25-
[tool.black]
26-
line-length = 100
27-
2825
[tool.coverage.report]
2926
exclude_lines = [
3027
"pragma: nocover",
3128
"raise NotImplementedError",
3229
"if TYPE_CHECKING:",
3330
]
3431

35-
[tool.isort]
36-
profile = "black"
37-
# lines_between_types = 1
32+
[tool.ruff]
33+
line-length = 100
34+
target-version = "py310"
35+
36+
[tool.ruff.lint]
37+
select = ["D", "E", "F", "I", "UP", "W", "RUF"]
38+
ignore = [
39+
"E501",
40+
"RUF001", # String contains ambiguous character (such as Greek letters)
41+
"RUF002", # Docstring contains ambiguous character (such as Greek letters)
42+
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
43+
"D100",
44+
"D101",
45+
"D102",
46+
"D103",
47+
"D104",
48+
"D105",
49+
"D107",
50+
"D200",
51+
"D202",
52+
"D203",
53+
"D204",
54+
"D205",
55+
"D209",
56+
"D212",
57+
"D213",
58+
"D301",
59+
"D400",
60+
"D401",
61+
"D403",
62+
"D413",
63+
"D415",
64+
"D417",
65+
]
66+
67+
[tool.ruff.lint.isort]
68+
lines-between-types = 1
3869

39-
[tool.nbqa.mutate]
40-
isort = 1
41-
black = 1
42-
pyupgrade = 1
70+
[tool.ruff.lint.per-file-ignores]
71+
'tests/*.py' = ['F841'] # Disable unused variable warning for test files
72+
'tests/statespace/*.py' = ['F401', 'F811'] # Disable unused import warning for test files; removes shared fixture imports

0 commit comments

Comments
 (0)