Code style¶
Formatting and linting¶
Astro uses Ruff for linting and formatting.
Setting |
Value |
|---|---|
Line length |
100 |
Target Python |
3.11 |
make lint # check only
make format # check formatting
make fix # auto-fix lint and format
Type checking¶
Astro uses ty for static type checking:
make typecheck # runs ty check
Type checking scope: src/astro (configured in pyproject.toml).
Conventions¶
Match existing module structure under
src/astro/Prefer
X | NoneoverOptional[X]Use explicit imports; follow Ruff isort rules
Keep changes minimal and focused
Pre-commit¶
Pre-commit runs:
Trailing whitespace and end-of-file fixes
YAML validation
Debug statement check
Test naming (
test_*.py)Ruff check (with auto-fix) and format
ty type check
Install with pre-commit install.
Per-file ignores¶
Configured in pyproject.toml:
tests/**— allows assert statements and mutable class defaultsexamples/**— allows mutable class defaults