Skip to content

Commit aca962d

Browse files
committed
Replace black with ruff
black depends on pathspec that is licensed under MPL 2.0. Even though MPL 2.0 can _maybe_ be included in an ASF project, I'd prefer to simplify the discussion and just replace black with ruff that is licensed as Apache 2.0, does not have any dependencies, and is already used by other Apache projects.
1 parent 8b4b95b commit aca962d

File tree

4 files changed

+17
-61
lines changed

4 files changed

+17
-61
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ See the [poetry docs](https://python-poetry.org/docs) for more.
3232

3333
# Linting and formatting
3434

35-
Code-style is enforced using [black](https://black.readthedocs.io/) and [flake8](https://flake8.pycqa.org/); import optimisation is handled by [isort](https://pycqa.github.io/isort/) and [autoflake](https://pypi.org/project/autoflake/). Linting is automatically applied when tox runs tests; if linting fails, you can fix trivial problems with:
35+
Code-style is enforced using [ruff](https://docs.astral.sh/ruff/) and [flake8](https://flake8.pycqa.org/); import optimisation is handled by [isort](https://pycqa.github.io/isort/) and [autoflake](https://pypi.org/project/autoflake/). Linting is automatically applied when tox runs tests; if linting fails, you can fix trivial problems with:
3636

3737
```
3838
./toxw -e format

poetry.lock

+10-54
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ pg8000 = "^1.31.2"
2525
pytest = "^6.2.2"
2626
pytz = "2021.1"
2727
tox = "^3.25.0"
28-
black = "^22.3.0"
2928
flake8 = "^4.0.1"
3029
autoflake = "^1.4"
3130
isort = "^5.10.1"
31+
ruff = "^0.6.9"
3232

3333
[tool.pytest.ini_options]
3434
filterwarnings = [
@@ -39,7 +39,7 @@ filterwarnings = [
3939
[tool.poetry.scripts]
4040
hunter = 'hunter.main:main'
4141

42-
[tool.black]
42+
[tool.ruff]
4343
line-length = 100
4444

4545
[tool.isort]

tox.ini

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ passenv =
1919
SSH_AUTH_SOCK
2020
setenv =
2121
BUILD_DIR = {toxinidir}/build/{envname}
22-
BLACK_OPTS =
22+
RUFF_OPTS =
2323
FLAKE8_OPTS = --count --show-source --statistics
2424
AUTOFLAKE_OPTS = --exclude build --recursive --remove-all-unused-imports
2525
POETRY_OPTS = -v
2626
PYTEST_OPTS =
2727

2828
# Linting should be quiet and fast
29-
lint: BLACK_OPTS = --quiet --fast
29+
lint: RUFF_OPTS = --quiet --fast
3030
lint: FLAKE8_OPTS =
3131
lint: POETRY_OPTS = --quiet --no-root
3232
commands_pre =
3333
./poetryw install {env:POETRY_OPTS}
3434
commands =
35-
black {env:BLACK_OPTS} --check --diff .
35+
ruff {env:RUFF_OPTS} check --diff .
3636
autoflake {env:AUTOFLAKE_OPTS} --check .
3737
isort --check --diff .
3838
flake8 {env:FLAKE8_OPTS}
@@ -43,7 +43,7 @@ commands =
4343
# environment
4444
[testenv:format]
4545
commands =
46-
black .
46+
ruff check --fix .
4747
autoflake {env:AUTOFLAKE_OPTS} --in-place .
4848
isort .
4949

0 commit comments

Comments
 (0)