Code style

Linting and formatting

unihan-db uses ruff for linting and formatting.

Lint the codebase:

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

Format the codebase:

$ uv run ruff format .

Type checking

mypy is configured in strict mode.

$ uv run mypy src tests

Conventions

  • from __future__ import annotations in every module.

  • Namespace imports for stdlib: import typing as t.

  • NumPy-style docstrings.

  • See [tool.ruff] in pyproject.toml for the full rule set.