diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..c246019 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +repos: + - repo: local + hooks: + - id: flake8-critical + name: flake8 critical errors + entry: poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + language: system + pass_filenames: false + + - id: mypy + name: mypy + entry: poetry run mypy cmr tests + language: system + pass_filenames: false + + - id: pytest + name: pytest + entry: poetry run pytest + language: system + pass_filenames: false + stages: [pre-push] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..e31c7a4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,38 @@ +# Contributing + +## Development setup + +Install the project dependencies with Poetry: + +```bash +poetry install +``` + +## Pre-commit checks + +The repository includes pre-commit hooks that mirror the important local CI checks: + +- critical `flake8` errors run before commits; +- `mypy` runs before commits; +- the full `pytest` suite runs before pushes. + +Install pre-commit, then enable both hook stages: + +```bash +python -m pip install pre-commit +pre-commit install --hook-type pre-commit --hook-type pre-push +``` + +Run all commit-stage hooks manually with: + +```bash +pre-commit run --all-files +``` + +Run the pre-push test hook manually with: + +```bash +pre-commit run --all-files --hook-stage pre-push +``` + +The hook commands use the project's Poetry environment, so run `poetry install` first.