Skip to content

Latest commit

 

History

History
59 lines (43 loc) · 1.78 KB

dev.md

File metadata and controls

59 lines (43 loc) · 1.78 KB

Develop

1. Code Style

We adopt PEP8 as the preferred code style.

We use pre-commit to check and format code automatically on every commit. The hook suite is defined in .pre-commit-config.yaml and includes:

  • black (line length 79): formatter
  • flake8: linter
  • pylint: linter
  • mypy: type checker
  • pre-commit-hooks: trailing whitespace, encoding pragma, YAML/JSON/TOML checks, private key detection, etc.

Flake8 configuration lives in setup.cfg.

Setup (one time after clone)

Install the development/test dependencies, then install the git hooks:

pip install pre-commit
pip install -r requirements-test.txt
pre-commit install

After this, every git commit runs the checks automatically; commits that fail the hooks are rejected (auto-fixing hooks such as black will rewrite files — review and re-stage, then commit again).

To check the whole repository manually:

pre-commit run --all-files

CI

.github/workflows/pre-commit.yml runs pre-commit run --all-files on every push and pull request, so code that bypasses the local hooks is still blocked in CI.

2. Tests

The current implementation lives at the package root. Archived transitional suites are separated from current coverage:

python -m pytest tests --ignore=tests/legacy_1x -q
coverage run -m pytest tests --ignore=tests/legacy_1x
coverage report -m
python -m pytest tests/legacy_1x -q
python -m pytest tests -q

Plain pytest runs both groups. The current and legacy groups also run as separate jobs in .github/workflows/unit_test.yml.