From 9bf61a9d480001fa14389d66f72b97cbd1e382dc Mon Sep 17 00:00:00 2001 From: Cyril Romain Date: Sun, 18 Feb 2024 17:29:25 +0100 Subject: [PATCH] prefer ruff over black and isort --- CONTRIBUTING.md | 25 +++++++++++-------------- Makefile | 8 ++++---- pyproject.toml | 6 ++---- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1298c7d..a265357 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ Which is the equivalent of: ```bash python3 -m pip install --user -e . -python3 -m pip install --user build black isort ruff pytest mypy types-PyYAML pre-commit +python3 -m pip install --user build ruff pytest mypy types-PyYAML pre-commit ``` There’s also a Makefile recipe for that: @@ -28,11 +28,11 @@ make dev Code Formating -------------------------------------------------------------------------------- -We rely on [black][1] and [isort][2] for that, with their default configurations: +We rely on [ruff][1] for that, with the isort rule enabled: ```bash -black kalamine -isort kalamine +ruff format kalamine +ruff check --fix kalamine ``` Alternative: @@ -41,18 +41,15 @@ Alternative: make format ``` -[1]: https://black.readthedocs.io -[2]: https://pycqa.github.io/isort/ - Code Linting -------------------------------------------------------------------------------- -We rely on [ruff][3] and [mypy][4] for that, with their default configurations: +We rely on [ruff][1] and [mypy][2] for that, with their default configurations: ```bash -black --check --quiet kalamine -isort --check --quiet kalamine +ruff format --check kalamine +ruff check kalamine ruff kalamine mypy kalamine ``` @@ -69,14 +66,14 @@ Many linting errors can be fixed automatically: ruff --fix kalamine ``` -[3]: https://docs.astral.sh/ruff/ -[4]: https://mypy.readthedocs.io +[1]: https://docs.astral.sh/ruff/ +[2]: https://mypy.readthedocs.io Unit Tests -------------------------------------------------------------------------------- -We rely on [pytest][5] for that, but the sample layouts must be built by +We rely on [pytest][3] for that, but the sample layouts must be built by kalamine first: ```bash @@ -90,7 +87,7 @@ Alternative: make test ``` -[5]: https://docs.pytest.org +[3]: https://docs.pytest.org Before Committing diff --git a/Makefile b/Makefile index dfc5255..7e4a2a2 100644 --- a/Makefile +++ b/Makefile @@ -8,12 +8,12 @@ dev: ## Install a development environment # python3 -m pip install --user --upgrade twine wheel format: ## Format sources - black kalamine - isort kalamine + ruff format kalamine + ruff check --fix kalamine lint: ## Lint sources - black --check --quiet kalamine - isort --check --quiet kalamine + ruff format --check kalamine + ruff check kalamine ruff kalamine mypy kalamine diff --git a/pyproject.toml b/pyproject.toml index d889c01..d7bba53 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,8 +35,6 @@ dependencies = [ [project.optional-dependencies] dev = [ - "black", - "isort", "ruff", "pytest", "mypy", @@ -50,5 +48,5 @@ Homepage = "https://github.com/OneDeadKey/kalamine" kalamine = "kalamine.cli:cli" xkalamine = "kalamine.cli_xkb:cli" -[tool.isort] -profile = "black" +[tool.ruff.lint] +extend-select = ["I"]