Code Style
Code quality is enforced by the ruff and ty linters, configured in pyproject.toml.
Basic Rules
- PEP 8: baseline recommendations for Python code style
- Line length: 120 characters
- Quotes: Double quotes only (
") - Docstrings: NumPy style
- The
Parameterssection is used to describe parameters, including parameter name, type, and a short description - The
Returnssection is used to describe return values - The
Raisessection is used to describe possible exceptions - Additional sections may be added when needed (for example,
Examples,Notes,Warnings,See Also, etc.)
- The
- Type annotations: Mandatory everywhere
- Modern syntax: Python 3.14+
- Naming follows:
- Classes —
CamelCase - Functions and variables —
snake_case - Constants —
UPPER_CASE - Private classes, functions, and variables must start with
_
- Classes —
Special exceptions:
__init__.py: Unused imports allowedtests/: Magic numbers allowed andassertstatements allowed
Automation
just fmt— automatic formattingjust lint— style and type checking