Skip to content

Commit 95ecfe1

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 2c04a31 commit 95ecfe1

File tree

6 files changed

+60
-292
lines changed

6 files changed

+60
-292
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ jobs:
2323
cache: 'poetry'
2424

2525
- name: Install dependencies
26-
run: poetry install -E "docs test coverage lint format"
26+
run: poetry install -E "docs test coverage lint"
2727

2828
- name: Print python versions
2929
run: |
3030
python -V
3131
poetry run python -V
3232
33-
- name: Lint with flake8
34-
run: poetry run flake8
33+
- name: Lint with ruff
34+
run: poetry run ruff .
3535

3636
- name: Lint with mypy
3737
run: poetry run mypy .

Makefile

Lines changed: 4 additions & 10 deletions
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

@@ -35,11 +29,11 @@ start_docs:
3529
design_docs:
3630
$(MAKE) -C docs design
3731

38-
flake8:
39-
flake8 vcspull tests
32+
ruff:
33+
ruff .
4034

41-
watch_flake8:
42-
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) flake8; else $(MAKE) flake8 entr_warn; fi
35+
watch_ruff:
36+
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) ruff; else $(MAKE) ruff entr_warn; fi
4337

4438
mypy:
4539
poetry run mypy `${PY_FILES}`

docs/developing.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $ cd vcspull
2222
Install packages:
2323

2424
```console
25-
$ poetry install -E "docs test coverage lint format"
25+
$ poetry install -E "docs test coverage lint"
2626
```
2727

2828
[installation documentation]: https://python-poetry.org/docs/#installation
@@ -163,56 +163,56 @@ $ make serve
163163

164164
## Linting
165165

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

169-
### flake8
170-
171-
[flake8] provides fast, reliable, barebones styling and linting.
168+
The project uses [ruff] to handles formatting, sorting imports and linting.
172169

173170
````{tab} Command
174171
175172
poetry:
176173
177174
```console
178-
$ poetry run flake8
175+
$ poetry run ruff
179176
```
180177
181178
If you setup manually:
182179
183180
```console
184-
$ flake8
181+
$ ruff .
185182
```
186183
187184
````
188185

189186
````{tab} make
190187
191188
```console
192-
$ make flake8
189+
$ make ruff
193190
```
194191
195192
````
196193

197194
````{tab} Watch
198195
199196
```console
200-
$ make watch_flake8
197+
$ make watch_ruff
201198
```
202199
203200
requires [`entr(1)`].
204201
205202
````
206203

207-
````{tab} Configuration
204+
````{tab} Fix files
205+
206+
poetry:
208207
209-
See `[flake8]` in setup.cfg.
208+
```console
209+
$ poetry run ruff . --fix
210+
```
210211
211-
```{literalinclude} ../setup.cfg
212-
:language: ini
213-
:start-at: "[flake8]"
214-
:end-before: "[isort]"
212+
If you setup manually:
215213
214+
```console
215+
$ ruff . --fix
216216
```
217217
218218
````
@@ -269,7 +269,7 @@ See `[tool.mypy]` in pyproject.toml.
269269

270270
## Publishing to PyPI
271271

272-
As of 0.10, [poetry] handles virtualenv creation, package requirements, versioning,
272+
[poetry] handles virtualenv creation, package requirements, versioning,
273273
building, and publishing. Therefore there is no setup.py or requirements files.
274274

275275
Update `__version__` in `__about__.py` and `pyproject.toml`::
@@ -284,7 +284,5 @@ Update `__version__` in `__about__.py` and `pyproject.toml`::
284284
[poetry]: https://python-poetry.org/
285285
[entr(1)]: http://eradman.com/entrproject/
286286
[`entr(1)`]: http://eradman.com/entrproject/
287-
[black]: https://github.com/psf/black
288-
[isort]: https://pypi.org/project/isort/
289-
[flake8]: https://flake8.pycqa.org/
287+
[ruff]: https://ruff.rs
290288
[mypy]: http://mypy-lang.org/

0 commit comments

Comments
 (0)