Skip to content

Commit 5d58a08

Browse files
Replace flake8, black and pylint with ruff
1 parent 3b6f449 commit 5d58a08

File tree

2 files changed

+34
-57
lines changed

2 files changed

+34
-57
lines changed

pyproject.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,23 @@ requires = [
7272
"build>=1.0.3,<1.1",
7373
]
7474
build-backend = "setuptools.build_meta"
75+
76+
[tool.ruff]
77+
extend-include = ["*.ipynb"]
78+
79+
[tool.ruff.lint]
80+
select = [
81+
"E", # pycodestyle
82+
"F", # Pyflakes
83+
"B", # flake8-bugbear
84+
"SIM", # flake8-simplify
85+
"I", # isort
86+
]
87+
88+
[tool.mypy]
89+
disable_error_code = [
90+
"misc",
91+
"no-any-return",
92+
]
93+
ignore_missing_imports = true
94+
strict = true

tox.ini

Lines changed: 14 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -29,79 +29,36 @@ commands = pytest --cov={[base]package} \
2929
--cov-report term \
3030
--cov-report=xml
3131

32-
[testenv:black]
33-
basepython = {[base]python}
34-
skip_install = {[base]skip_install}
35-
deps =
36-
black>=23.12.1,<24.0
37-
commands = black --check --diff {[base]package}
38-
39-
[flake8]
40-
# Set to match black line length (default 88)
41-
max-line-length = 88
42-
ignore = D401, I902, W503
43-
exclude =
44-
.tox,
45-
.git,
46-
docs/source/conf.py,
47-
build,
48-
dist,
49-
*.pyc,
50-
*.egg-info,
51-
.cache,
52-
.eggs,
53-
.venv,
54-
.env
55-
max-complexity = 10
32+
[pytest]
33+
addopts = -ra -q
34+
norecursedirs = docs
5635

57-
[testenv:flake8]
36+
[testenv:ruff]
5837
basepython = {[base]python}
5938
skip_install = {[base]skip_install}
6039
deps =
61-
flake8>=7.0.0,<8.0
62-
flake8-bugbear>=23.12.2,<24.0
63-
flake8-docstrings>=1.7.0,<1.8
64-
flake8-typing-imports>=1.15.0,<1.16
65-
pep8-naming>=0.13.3,<0.14
66-
pydocstyle>=6.3.0,<6.4
67-
commands = flake8
40+
ruff>=0.3.4,<0.4
41+
commands = ruff check --config pyproject.toml .
42+
ruff format --config pyproject.toml .
6843

6944
[testenv:mypy]
7045
basepython = {[base]python}
7146
skip_install = {[base]skip_install}
7247
deps =
73-
# FIXME: 0.971 version generates new unhandled warnings
74-
mypy>=0.941,<0.971
48+
mypy>=1.9.0,<1.10
7549
types-requests>=2.31.0,<2.32
76-
plugins = numpy.typing.mypy_plugin
77-
commands = mypy {[base]package}
78-
79-
[pytest]
80-
addopts = -ra -q
81-
norecursedirs = docs
82-
83-
[testenv:pylint]
84-
basepython = {[base]python}
85-
skip_install = {[base]skip_install}
86-
deps =
87-
pylint>=3.0.3,<3.1.0
88-
commands =
89-
pylint {[base]package} --good-names=b,d,df,e,f,h,i,j,m,n,p,w,x,y,z,r,D,N,X,en,js,kl,S1,S2,Tt,XY_chunks_combinations,X_chunks,X_chunks_combinations,X_concat,X_counter,X_extra,X_fold_test,X_fold_train,X_hist,X_merge,X_new_context,X_new_ref,X_num_samples,X_queue,X_sorted,X_percents,X_permuted,X_permuted_num_samples,X_permuted_,X_permuted_concat,X_permuted_ref_,X_permuted_ref_num_samples,X_preprocessed,X_ref,X_ref_hist,X_ref_counter,X_ref_percents,X_ref_rvs,X_ref_rv_histogram,X_rvs,X_rv_histogram,X_ref,_X_ref,X_ref_num_samples,X_ref_univariate,X_ref_multivariate,X_sample,X_samples,X_test,X_test_univariate,X_test_multivariate,X_train,y,Y,Y_chunks,Y_chunks_copy,Y_chunks_combinations,Y_hist,Y_percents,Y_num_samples,_X_num_samples,X_size,Y_size --disable=too-many-instance-attributes,consider-using-with,too-few-public-methods --ignore-comments=yes --ignore-docstrings=yes --ignore-imports=yes --max-args=7 --min-similarity-lines=13 --extension-pkg-whitelist=scipy.special
50+
types-toml>=0.10.0,<0.11
51+
types-tqdm>=4.66,<4.67
52+
commands = mypy --config-file pyproject.toml .
9053

9154
[testenv:linters]
55+
basepython = {[base]python}
9256
skip_install = {[base]skip_install}
9357
setenv =
9458
PYTHONPATH = $PYTHONPATH:{toxinidir}:{[base]venv}/lib/{[base]python}/site-packages
95-
allowlist_externals =
96-
{[base]venv}/bin/black
97-
{[base]venv}/bin/pylint
9859
deps =
99-
{[testenv:black]deps}
100-
{[testenv:flake8]deps}
60+
{[testenv:ruff]deps}
10161
{[testenv:mypy]deps}
102-
{[testenv:pylint]deps}
10362
commands =
104-
{[testenv:black]commands}
105-
{[testenv:flake8]commands}
63+
{[testenv:ruff]commands}
10664
{[testenv:mypy]commands}
107-
{[testenv:pylint]commands}

0 commit comments

Comments
 (0)