Skip to content

Commit efd5b75

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 524bb3e commit efd5b75

File tree

6 files changed

+58
-359
lines changed

6 files changed

+58
-359
lines changed

Diff for: .github/workflows/tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ jobs:
5656
run: |
5757
poetry install -E "test coverage lint"
5858
59-
- name: Lint with flake8
60-
run: poetry run flake8
59+
- name: Lint with ruff .
60+
run: poetry run ruff .
6161

6262
- name: Lint with mypy
6363
run: poetry run mypy .

Diff for: 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 @@ start_docs:
4438
design_docs:
4539
$(MAKE) -C docs design
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}`

Diff for: docs/developing.md

+16-25
Original file line numberDiff line numberDiff line change
@@ -329,63 +329,56 @@ this will load the `.tmuxp.yaml` in the root of the project.
329329

330330
## Formatting
331331

332-
The project uses [black] and [isort] (one after the other). Configurations are in `pyproject.toml`
333-
and `setup.cfg`:
332+
### ruff
334333

335-
- `make black isort`: Run `black` first, then `isort` to handle import nuances
336-
337-
## Linting
338-
339-
[flake8] and [mypy] run via CI in our GitHub Actions. See the configuration in `pyproject.toml` and
340-
`setup.cfg`.
341-
342-
### flake8
343-
344-
[flake8] provides fast, reliable, barebones styling and linting.
334+
The project uses [ruff] to handles formatting, sorting imports and linting.
345335

346336
````{tab} Command
347337
348338
poetry:
349339
350340
```console
351-
$ poetry run flake8
341+
$ poetry run ruff
352342
```
353343
354344
If you setup manually:
355345
356346
```console
357-
$ flake8
347+
$ ruff .
358348
```
359349
360350
````
361351

362352
````{tab} make
363353
364354
```console
365-
$ make flake8
355+
$ make ruff
366356
```
367357
368358
````
369359

370360
````{tab} Watch
371361
372362
```console
373-
$ make watch_flake8
363+
$ make watch_ruff
374364
```
375365
376366
requires [`entr(1)`].
377367
378368
````
379369

380-
````{tab} Configuration
370+
````{tab} Fix files
371+
372+
poetry:
381373
382-
See `[flake8]` in setup.cfg.
374+
```console
375+
$ poetry run ruff . --fix
376+
```
383377
384-
```{literalinclude} ../setup.cfg
385-
:language: ini
386-
:start-at: "[flake8]"
387-
:end-before: "[isort]"
378+
If you setup manually:
388379
380+
```console
381+
$ ruff . --fix
389382
```
390383
391384
````
@@ -443,9 +436,7 @@ the [gh build site].
443436
[py.test usage argument]: https://pytest.org/latest/usage.html
444437
[entr]: http://entrproject.org/
445438
[`entr(1)`]: http://entrproject.org/
446-
[black]: https://github.com/psf/black
447-
[isort]: https://pypi.org/project/isort/
448-
[flake8]: https://flake8.pycqa.org/
439+
[ruff]: https://ruff.rs
449440
[mypy]: http://mypy-lang.org/
450441
[github actions]: https://github.com/features/actions
451442
[gh build site]: https://github.com/tmux-python/tmuxp/actions?query=workflow%3Atests

0 commit comments

Comments
 (0)