File tree Expand file tree Collapse file tree 8 files changed +41
-58
lines changed Expand file tree Collapse file tree 8 files changed +41
-58
lines changed Original file line number Diff line number Diff line change @@ -55,18 +55,11 @@ jobs:
55
55
- uses : actions/setup-python@v3
56
56
57
57
- name : Lint code
58
- uses : psf/black@stable
59
-
60
- - name : Flake code
61
58
run : |
62
- python -m pip install flake8 Flake8-pyproject flake8-typing-imports
63
- python -m flake8 src tests
64
-
65
- - name : Check import ordering
66
- uses : isort/isort-action@master
67
- with :
68
- configuration : --check-only
69
-
59
+ python -m pip install ruff
60
+ ruff check
61
+ ruff format --check
62
+
70
63
- name : Validate pyproject.toml
71
64
run : |
72
65
python -m pip install validate-pyproject[all]
Original file line number Diff line number Diff line change 1
1
repos :
2
- - repo : https://github.com/myint/autoflake
3
- rev : v1.4
4
- hooks :
5
- - id : autoflake
6
- args : ["--in-place", "--remove-all-unused-imports"]
7
- - repo : https://github.com/PyCQA/flake8
8
- rev : 6.1.0
9
- hooks :
10
- - id : flake8
11
- additional_dependencies :
12
- - " flake8-typing-imports"
13
- - " Flake8-pyproject"
14
- - repo : https://github.com/PyCQA/isort
15
- rev : 5.12.0
16
- hooks :
17
- - id : isort
18
- - repo : https://github.com/psf/black
19
- rev : 22.3.0
20
- hooks :
21
- - id : black
2
+ - repo : https://github.com/astral-sh/ruff-pre-commit
3
+ # ruff version
4
+ rev : v0.6.2
5
+ hooks :
6
+ # run the linter
7
+ - id : ruff
8
+ # run the formatter
9
+ - id : ruff-format
22
10
- repo : https://github.com/abravalheri/validate-pyproject
23
11
rev : v0.10.1
24
12
hooks :
Original file line number Diff line number Diff line change 21
21
lint : check
22
22
bin/lint.sh
23
23
24
+ fmt : check
25
+ bin/fmt.sh
26
+
24
27
test : check
25
28
bin/test.sh
26
29
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ dir=$( dirname " $0 " )
4
+ cd " $dir /.."
5
+
6
+ exitCode=0
7
+ ruff check --fix
8
+ code=$? ; test $code -eq 0 || exitCode=$code
9
+ ruff format
10
+ code=$? ; test $code -eq 0 || exitCode=$code
11
+ exit $exitCode
Original file line number Diff line number Diff line change @@ -4,11 +4,9 @@ dir=$(dirname "$0")
4
4
cd " $dir /.."
5
5
6
6
exitCode=0
7
- black src tests
7
+ ruff check
8
8
code=$? ; test $code -eq 0 || exitCode=$code
9
- isort src tests
10
- code=$? ; test $code -eq 0 || exitCode=$code
11
- python -m flake8 src tests
9
+ ruff format --check
12
10
code=$? ; test $code -eq 0 || exitCode=$code
13
11
validate-pyproject pyproject.toml
14
12
code=$? ; test $code -eq 0 || exitCode=$code
Original file line number Diff line number Diff line change @@ -39,22 +39,17 @@ dependencies:
39
39
- pooch # for scikit image
40
40
- scikit-image
41
41
# Developer tools
42
- - autopep8
43
- - black
44
- - flake8
45
- - flake8-typing-imports
46
- - isort
47
42
- myst-nb
48
43
- pre-commit
49
44
- python-build
50
45
- pytest
51
46
- pytest-cov
47
+ - ruff
52
48
- sphinx
53
49
- sphinx_rtd_theme
54
50
- pip
55
51
- pip :
56
52
- readthedocs-sphinx-search
57
- - flake8-pyproject
58
53
- validate-pyproject[all]
59
54
# Project from source
60
55
- -e .
Original file line number Diff line number Diff line change @@ -49,17 +49,12 @@ dependencies = [
49
49
# NB: Keep this in sync with dev-environment.yml!
50
50
# Development tools
51
51
dev = [
52
- " autopep8" ,
53
- " black" ,
54
52
" build" ,
55
- " flake8" ,
56
- " flake8-pyproject" ,
57
- " flake8-typing-imports" ,
58
- " isort" ,
59
53
" myst-nb" ,
60
54
" pre-commit" ,
61
55
" pytest" ,
62
56
" pytest-cov" ,
57
+ " ruff" ,
63
58
" sphinx" ,
64
59
" sphinx_rtd_theme" ,
65
60
" validate-pyproject[all]" ,
@@ -96,20 +91,19 @@ include-package-data = false
96
91
where = [" src" ]
97
92
namespaces = false
98
93
99
- [tool .black ]
100
- exclude = ' dist|doc'
94
+ # ruff configuration
95
+ [tool .ruff ]
96
+ line-length = 88
97
+ src = [" src" , " tests" ]
98
+ include = [" pyproject.toml" , " src/**/*.py" , " tests/**/*.py" ]
99
+ extend-exclude = [" bin" , " build" , " dist" ]
101
100
102
- # Thanks to Flake8-pyproject, we can configure flake8 here!
103
- [tool .flake8 ]
104
- exclude = [" build" , " dist" , " doc" ]
101
+ [tool .ruff .lint ]
105
102
extend-ignore = [" E203" ]
106
- # See https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8
107
- max-line-length = 88
108
- min_python_version = " 3.8"
109
103
110
- [tool .isort ]
111
- profile = " black "
112
- skip = [" doc " ]
104
+ [tool .ruff . lint . per-file-ignores ]
105
+ # Ignore `E402` (import violations) in all `__init__.py` files, and in `path/to/file.py`.
106
+ "__init__.py" = [" E402 " , " F401 " ]
113
107
114
108
[tool .pytest .ini_options ]
115
109
addopts = " --ignore=docs"
Original file line number Diff line number Diff line change 14
14
import imagej
15
15
ij = imagej.init()
16
16
"""
17
+
17
18
import importlib
18
19
import logging
19
20
import os
You can’t perform that action at this time.
0 commit comments