Skip to content

Commit 95d81f3

Browse files
committed
Use ruff isort plugin instead of isort
1 parent fc57075 commit 95d81f3

4 files changed

+13
-18
lines changed

.pre-commit-config.yaml

+2-6
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,13 @@ repos:
2525
hooks:
2626
- id: flake8
2727
files: ^(xknxproject|examples|docs)/.+\.py$
28-
- repo: https://github.com/PyCQA/isort
29-
rev: 5.12.0
30-
hooks:
31-
- id: isort
32-
args:
33-
- --resolve-all-configs
3428
- repo: https://github.com/charliermarsh/ruff-pre-commit
3529
# Ruff version.
3630
rev: 'v0.0.292'
3731
hooks:
3832
- id: ruff
33+
# in CI it is directly run by tox to allow dependency upgrade checks
34+
stages: [pre-commit]
3935
args: [ --fix, --exit-non-zero-on-fix ]
4036
- repo: https://github.com/pre-commit/pre-commit-hooks
4137
rev: v4.5.0

pyproject.toml

+5-8
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,9 @@ version = {attr = "xknxproject.__version__.__version__"}
3535
include = ["xknxproject*"]
3636

3737
[tool.black]
38-
target-version = ["py39", "py310", "py311", "py312"]
3938
exclude = "generated"
4039

4140

42-
[tool.isort]
43-
profile = "black"
44-
# will group `import x` and `from x import` of the same module.
45-
force_sort_within_sections = true
46-
combine_as_imports = true
47-
48-
4941
[tool.mypy]
5042
python_version = "3.9"
5143
strict = true
@@ -125,6 +117,7 @@ select = [
125117
"D", # pydocstyle
126118
"E", # pycodestyle
127119
"F", # pyflakes
120+
"I", # isort
128121
"RUF", # ruff specific
129122
"T20", # print
130123
"UP", # pyupgrade
@@ -139,3 +132,7 @@ ignore = [
139132
extend-exclude = [
140133
"script",
141134
]
135+
136+
[tool.ruff.isort]
137+
force-sort-within-sections = true
138+
combine-as-imports = true

requirements_testing.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
-r requirements_production.txt
22
pre-commit==3.5.0
3-
isort==5.12.0
43
flake8==6.1.0
54
pylint==3.0.2
65
pytest==7.4.3

tox.ini

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py39, py310, py311, py312, typing, lint, pylint
2+
envlist = py39, py310, py311, py312, ruff, typing, lint, pylint
33
skip_missing_interpreters = True
44

55
[testenv]
@@ -14,12 +14,10 @@ wheel_build_env = .pkg
1414
[testenv:lint]
1515
basepython = python3
1616
commands =
17-
ruff check {posargs:.}
1817
pre-commit run codespell {posargs: --all-files}
1918
pre-commit run flake8 {posargs: --all-files}
2019
pre-commit run pyupgrade {posargs: --all-files}
2120
pre-commit run black {posargs: --all-files}
22-
pre-commit run isort {posargs: --all-files}
2321
pre-commit run check-json {posargs: --all-files}
2422
pre-commit run trailing-whitespace {posargs: --all-files}
2523

@@ -28,6 +26,11 @@ basepython = python3
2826
commands =
2927
pylint xknxproject
3028

29+
[testenv:ruff]
30+
basepython = python3
31+
commands =
32+
ruff check {posargs:.}
33+
3134
[testenv:typing]
3235
basepython = python3
3336
commands =

0 commit comments

Comments
 (0)