Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 1.33 KB

dev.md

File metadata and controls

43 lines (31 loc) · 1.33 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.