Skip to content

Commit 1591758

Browse files
committed
switch to ruff
1 parent a0cb515 commit 1591758

File tree

6 files changed

+33
-33
lines changed

6 files changed

+33
-33
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22

33
- [ ] Closes #xxx
44
- [ ] Tests added
5-
- [ ] Passes `isort . && black . && flake8`
65
- [ ] Fully documented, including `CHANGELOG.md`

.pre-commit-config.yaml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,14 @@ repos:
88
- id: check-yaml
99
- id: debug-statements
1010
- id: mixed-line-ending
11-
# This wants to go before isort & flake8
12-
- repo: https://github.com/PyCQA/autoflake
13-
rev: "v2.3.1"
11+
- repo: https://github.com/astral-sh/ruff-pre-commit
12+
# Ruff version.
13+
rev: 'v0.12.7'
1414
hooks:
15-
- id: autoflake # isort should run before black as black sometimes tweaks the isort output
16-
args: ["--in-place", "--ignore-init-module-imports"]
17-
- repo: https://github.com/PyCQA/isort
18-
rev: 5.13.2
19-
hooks:
20-
- id: isort
15+
- id: ruff
16+
args: ["--fix", "--show-fixes"]
2117
# https://github.com/python/black#version-control-integration
2218
- repo: https://github.com/psf/black
2319
rev: 24.10.0
2420
hooks:
2521
- id: black
26-
- repo: https://github.com/PyCQA/flake8
27-
rev: 7.1.1
28-
hooks:
29-
- id: flake8

ci/min_deps_check.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"pytest-cov",
3131
"pytest-env",
3232
"pytest-xdist",
33+
"ruff",
3334
}
3435

3536
POLICY_MONTHS = {"python": 24, "numpy": 18, "setuptools": 42}

ci/requirements/environment.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ dependencies:
1010
- xarray
1111
# formatting
1212
- black
13-
- isort
14-
- flake8
13+
- ruff
1514
# for testing
1615
- pytest
1716
- pytest-cov

pyproject.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,32 @@ build-backend = "setuptools.build_meta"
99
fallback_version = "999"
1010
version_scheme = "no-guess-dev"
1111

12+
13+
[tool.ruff]
14+
# also check notebooks
15+
extend-include = ["*.ipynb"]
16+
target-version = "py310"
17+
18+
[tool.ruff.lint]
19+
# E402: module level import not at top of file
20+
# E501: line too long - let the formatter worry about this
21+
# E731: do not assign a lambda expression, use a def
22+
ignore = [
23+
"E402",
24+
"E501",
25+
"E731",
26+
]
27+
select = [
28+
"F", # Pyflakes
29+
"E", # Pycodestyle
30+
"W", # warnings
31+
"I", # isort
32+
"UP", # Pyupgrade
33+
]
34+
35+
[tool.ruff.lint.isort]
36+
known-first-party = ["mplotutils"]
37+
1238
[tool.pytest.ini_options]
1339

1440
log_cli_level = "INFO"

setup.cfg

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,6 @@ install_requires =
2929
numpy >=1.26
3030
xarray >=2024.7
3131

32-
[flake8]
33-
ignore=
34-
# E203: whitespace before ':' - doesn't work well with black
35-
# E402: module level import not at top of file
36-
# E501: line too long - let black worry about that
37-
# E731: do not assign a lambda expression, use a def
38-
# W503: line break before binary operator
39-
E203, E402, E501, E731, W503
40-
exclude =
41-
build
42-
docs
43-
.git
44-
45-
[isort]
46-
profile = black
47-
known_first_party = mplotutils
48-
4932
[coverage:run]
5033
omit =
5134
*/tests/*,

0 commit comments

Comments
 (0)