After checking out the repository, you can install kalamine and its development dependencies like this:
python3 -m pip install --user .[dev]
Which is the equivalent of:
python3 -m pip install --user -e .
python3 -m pip install --user build black isort ruff pytest mypy types-PyYAML pre-commit
There’s also a Makefile recipe for that:
make dev
We rely on black and isort for that, with their default configurations:
black kalamine
isort kalamine
Alternative:
make format
We rely on ruff and mypy for that, with their default configurations:
black --check --quiet kalamine
isort --check --quiet kalamine
ruff check kalamine
mypy kalamine
Alternative:
make lint
Many linting errors can be fixed automatically:
ruff check --fix kalamine
We rely on pytest for that, but the sample layouts must be built by kalamine first:
python3 -m kalamine.cli make layouts/*.toml
pytest
Alternative:
make test
You may ensure manually that your commit will pass the Github CI (continuous integration) with:
make
But setting up a git pre-commit hook is strongly recommended. Just create an executable .git/hooks/pre-commit
file containing:
#!/bin/sh
make
This is asking git to run the above command before any commit is created, and to abort the commit if it fails.