Software quality checks are important for a healthy community. They make software easier to modify, and in the case of code formatters, can eliminate unproductive debates.
Docstrings and autodoc¶
We use docstrings on components of our software’s public API and use “autodoc” tools to generate API documentation from docstrings as the source of truth.
Typechecking¶
We use type annotations and type checkers to:
protect us from bugs as early in the development cycle as possible.
make our code more self-documenting
stay in line with modern Pythonic conventions; typechecking is strongly adopted by the Python community.
enable easier and safer refactoring of code.
We use mypy for typechecking and aim to enable strict mode for all projects.
Code linting¶
Linters help avoid common programming pitfalls and readability problems.
We use Ruff for linting and aim to enable as many rules as possible.
Code formatting¶
Using a code formatter can eliminate bikeshedding about code style.
We use Ruff for code formatting.
Unit tests¶
We use unit tests to exercise our code and ensure its behavior matches expectations.
We use pytest for testing.
We use pytest-cov to measure test coverage and aim for a reasonable standard of coverage.
Spelling¶
To help identify common spelling errors, we use Codespell.
Automations¶
We use pre-commit to automate running code quality tools.
We only set up fast tools like Ruff with pre-commit, otherwise the commit process becomes annoying (for example, typechecking is slow so we don’t set up typechecking with pre-commit).
We use pre-commit.ci to automate pre-commit checks in PRs.
We use GitHub Actions to automate all other quality checks.