Skip to content

Commit

Permalink
Improve ergonomics of tox lint jobs (#1084)
Browse files Browse the repository at this point in the history
This fixes the `lint` job for `tox>=4`, which uses `whitelist_externals`
is removed in favour of `allowlist_externals`.  This also makes the
`lint` and `black` runs skip installation of the package, which makes
them much faster to use while making changes, and these are static
analysis tools, so don't need to install.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
jakelishman and mergify[bot] authored Feb 9, 2024
1 parent f4776fb commit 5a99100
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ target-version = ['py38', 'py39', 'py310', 'py311']
[tool.ruff]
line-length = 105 # more lenient than black due to long function signatures
src = ["rustworkx", "setup.py", "retworkx", "tests"]
select = [
lint.select = [
"E", # pycodestyle
"F", # pyflakes
"UP", # pyupgrade
Expand All @@ -19,7 +19,7 @@ select = [
target-version = "py38"
extend-exclude = ["doc"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"rustworkx/__init__.py" = ["F405", "F403"]
"*.pyi" = ["F403", "F405", "PYI001", "PYI002"]

Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ commands =

[testenv:lint]
basepython = python3
skip_install = true
deps =
black~=22.0
ruff
setuptools-rust
whitelist_externals=cargo
allowlist_externals=cargo
commands =
black --check --diff {posargs} '../rustworkx' '../tests' '../retworkx'
ruff check ../rustworkx ../retworkx . ../setup.py
Expand Down Expand Up @@ -68,6 +68,7 @@ commands = rm -rf {toxinidir}/docs/build {toxinidir}/docs/source/apiref

[testenv:black]
basepython = python3
skip_install = true
deps =
black~=22.0
commands = black {posargs} '../rustworkx' '../tests' '../retworkx'
Expand Down

0 comments on commit 5a99100

Please sign in to comment.