Skip to content

Commit d3613a0

Browse files
committed
ci!: Add ruff, replacing isort, black, flake8 and its plugins
See also: - https://ruff.rs/ - https://beta.ruff.rs/ - https://github.com/charliermarsh/ruff
1 parent 641be77 commit d3613a0

File tree

6 files changed

+61
-351
lines changed

6 files changed

+61
-351
lines changed

.github/workflows/tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ jobs:
5050
run: |
5151
poetry install -E "test coverage lint"
5252
53-
- name: Lint with flake8
53+
- name: Lint with ruff
5454
run: |
55-
poetry run flake8
55+
poetry run ruff .
5656
5757
- name: Lint with mypy
5858
run: poetry run mypy .

Makefile

+4-10
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ entr_warn:
1111
@echo "See https://eradman.com/entrproject/ "
1212
@echo "----------------------------------------------------------"
1313

14-
isort:
15-
poetry run isort `${PY_FILES}`
16-
17-
black:
18-
poetry run black `${PY_FILES}`
19-
2014
test:
2115
poetry run py.test $(test)
2216

@@ -44,11 +38,11 @@ serve_docs:
4438
dev_docs:
4539
$(MAKE) -j watch_docs serve_docs
4640

47-
flake8:
48-
poetry run flake8
41+
ruff:
42+
poetry run ruff .
4943

50-
watch_flake8:
51-
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) flake8; else $(MAKE) flake8 entr_warn; fi
44+
watch_ruff:
45+
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) ruff; else $(MAKE) ruff entr_warn; fi
5246

5347
mypy:
5448
poetry run mypy `${PY_FILES}`

docs/developing.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ $ cd libtmux
1111
```
1212

1313
```console
14-
$ poetry install -E "docs test coverage lint format"
14+
$ poetry install -E "docs test coverage lint ruff"
1515
```
1616

1717
Makefile commands prefixed with `watch_` will watch files and rerun.
@@ -61,60 +61,62 @@ and `setup.cfg`:
6161

6262
## Linting
6363

64-
[flake8] and [mypy] run via CI in our GitHub Actions. See the configuration in `pyproject.toml` and
65-
`setup.cfg`.
64+
### ruff
6665

67-
### flake8
68-
69-
[flake8] provides fast, reliable, barebones styling and linting.
66+
The project uses [ruff] to handles formatting, sorting imports and linting.
7067

7168
````{tab} Command
7269
7370
poetry:
7471
7572
```console
76-
$ poetry run flake8
73+
$ poetry run ruff
7774
```
7875
7976
If you setup manually:
8077
8178
```console
82-
$ flake8
79+
$ ruff .
8380
```
8481
8582
````
8683

8784
````{tab} make
8885
8986
```console
90-
$ make flake8
87+
$ make ruff
9188
```
9289
9390
````
9491

9592
````{tab} Watch
9693
9794
```console
98-
$ make watch_flake8
95+
$ make watch_ruff
9996
```
10097
10198
requires [`entr(1)`].
10299
103100
````
104101

105-
````{tab} Configuration
102+
````{tab} Fix files
106103
107-
See `[flake8]` in setup.cfg.
104+
poetry:
108105
109-
```{literalinclude} ../setup.cfg
110-
:language: ini
111-
:start-at: "[flake8]"
112-
:end-before: "[isort]"
106+
```console
107+
$ poetry run ruff . --fix
108+
```
113109
110+
If you setup manually:
111+
112+
```console
113+
$ ruff . --fix
114114
```
115115
116116
````
117117

118+
119+
118120
### mypy
119121

120122
[mypy] is used for static type checking.
@@ -213,7 +215,5 @@ Update `__version__` in `__about__.py` and `pyproject.toml`::
213215
[poetry]: https://python-poetry.org/
214216
[entr(1)]: http://eradman.com/entrproject/
215217
[`entr(1)`]: http://eradman.com/entrproject/
216-
[black]: https://github.com/psf/black
217-
[isort]: https://pypi.org/project/isort/
218-
[flake8]: https://flake8.pycqa.org/
218+
[ruff]: https://ruff.rs
219219
[mypy]: http://mypy-lang.org/

0 commit comments

Comments
 (0)