Contributing¶
Thanks for helping improve envdrift! This guide summarizes local setup, style rules, and the checks that keep the project healthy.
Quick start¶
- Install deps:
make dev(usesuvto install all extras, including tooling like pre-commit, ruff, bandit, pytest, mkdocs). - Keep tools current:
uv lock --upgradewhen bumping dependencies. - Run everything:
make check(ruff lint, typecheck, bandit, tests) plus docs:make docsandmake lint-docs.
Pre-commit hooks¶
- Install hooks once:
uv run pre-commit install. (You can also runenvdrift hook --installto write the hook config automatically.) - Run on demand:
uv run pre-commit run --all-files. - Hooks enforce ruff lint/formatting, type/style checks, and markdown linting before commits land.
Editor setup¶
- VS Code: install the “Ruff” extension (ms-python.vscode-pylance + charliermarsh.ruff). '
Enable “Format on Save” with Ruff to match CI formatting (
ruff format+ruff check --fix). - VS Code: install the "markdownlint" extension for docs linting.
- Optional: add a pre-commit task to run
uv run pre-commit run --files $FilePath.
Makefile guide¶
make dev– install all dev dependencies.make lint/make format– ruff checks (format also runsruff format).make typecheck– pyrefly static analysis.make security– bandit security scan.make test– pytest suite.make check– lint + typecheck + security + tests.make docs– mkdocs build (--strict).make lint-docs– markdownlint (keeps docs tidy).make docs-serve– live docs preview at http://127.0.0.1:8000/.
Required checks and style¶
- Lint/Format: Ruff (
ruff check,ruff format). Noblack/isort; Ruff rules win. - Types: Pyrefly (
make typecheck). - Security: Bandit (
make security). - Tests: Pytest (
make test); add coverage for new code paths. See the Testing Guide for integration tests with Docker. - Docs:
make docsmust pass; lint docs withmake lint-docs(markdownlint rules: headings increment, fenced code blocks, no trailing spaces).
PR checklist¶
- [ ] Code formatted via
make format(or Ruff on save). - [ ]
make checkpasses locally. - [ ] Docs updated when behavior or flags change;
make docsandmake lint-docspass. - [ ] Hooks installed (
uv run pre-commit run --all-filesclean). - [ ] New functionality covered by tests where practical.