Code Style¶
cihai follows consistent coding standards across all repositories in the cihai organization.
Formatting and linting¶
ruff handles formatting, import sorting, and linting in a single tool.
$ uv run ruff check .
$ uv run ruff format .
Auto-fix safe lint violations:
$ uv run ruff check . --fix --show-fixes
Type checking¶
mypy with strict = true is used for static type
checking.
$ uv run mypy .
Docstrings¶
Use NumPy-style docstrings with reStructuredText markup.
Imports¶
Use
from __future__ import annotationsat the top of every module.Use namespace imports for the standard library:
import pathlibrather thanfrom pathlib import Path.Use
import typing as tand access members viat.NamedTuple, etc.