Code Quality
All code merged into Snowpack must pass linting, formatting, and strict type checking with zero violations. This page covers the tools and conventions enforced across the project.
Ruff — linting and formatting
Snowpack uses Ruff for both linting and code
formatting. The configuration lives in pyproject.toml.
uv run ruff check . # Lint the entire codebaseuv run ruff check --fix . # Lint and auto-fix safe violationsuv run ruff format . # Format all filesKey settings:
| Setting | Value |
|---|---|
| Line length | 120 |
| Python target | 3.12 |
| Enabled rule sets | E, F, I, N, W, UP, B, SIM, TCH, RUF |
All code must pass both ruff check and ruff format --check with zero
violations before it can be merged.
mypy — strict type checking
Snowpack runs mypy in strict mode. Every function must have complete type annotations for all parameters and the return type.
uv run mypy snowpack/Conventions:
- Add
from __future__ import annotationsat the top of every module. - Use
Protocolfor interfaces (e.g., theQueryEngineprotocol), not abstract base classes. - Use
TYPE_CHECKINGblocks for imports that are only needed at type-check time.
pytest — testing conventions
Tests live in the tests/ directory and mirror the snowpack/ package
structure. For example, tests for snowpack/analyzer.py go in
tests/unit/test_analyzer.py.
uv run pytest # Full suiteuv run pytest -x # Stop on first failureuv run pytest tests/unit/ # Unit tests onlyuv run pytest --cov=snowpack # With coverageMocking strategy:
- AWS (Glue) — use
mototo mock Glue API calls. - Spark / Thrift — use
unittest.mockto mockSparkQueryEngineand Thrift connections.
Every new module must have corresponding tests before it can be merged.
Commit conventions
Snowpack follows Conventional Commits. Every commit message must start with one of these prefixes:
| Prefix | Use for |
|---|---|
feat: | New features or capabilities. |
fix: | Bug fixes. |
refactor: | Code restructuring with no behavior change. |
test: | Adding or updating tests. |
docs: | Documentation changes. |
chore: | Dependency updates, CI config, tooling. |
Keep commits focused — each commit should represent one logical change. Avoid mixing unrelated changes in a single commit.