Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefer ruff over black and isort #116

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
```
Expand All @@ -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
Expand All @@ -90,7 +87,7 @@ Alternative:
make test
```

[5]: https://docs.pytest.org
[3]: https://docs.pytest.org


Before Committing
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ dependencies = [

[project.optional-dependencies]
dev = [
"black",
"isort",
"ruff",
"pytest",
"mypy",
Expand All @@ -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"]