Code Style

Formatting and linting

unihan-etl uses ruff for both formatting and linting.

$ uv run ruff format .
$ uv run ruff check . --fix --show-fixes

Type checking

mypy runs in strict mode.

$ uv run mypy src tests

Docstrings

Follow NumPy-style docstrings in reStructuredText format.

Imports

  • Begin every module with from __future__ import annotations.

  • Prefer namespace imports for stdlib: import typing as t, import pathlib.

  • Third-party packages may use from X import Y.