Skip to content

Installation

CoTyper needs Python 3.10 or newer. Pydantic (>= 2.11.5) and Typer (>= 0.27, which no longer depends on Click) are installed as dependencies. CoTyper does not pin pydantic-core; Pydantic brings in its matching version. CoTyper supports Typer 0.27.x. Custom parameter types have no public Typer API, so the upper bound (<0.28) is only raised after checking each new Typer minor release. On Python 3.10, which has no built-in tomllib, tomli is installed as well. Rich is a dependency too (Typer needs it anyway), so the rich logging backend works out of the box. The optional extra loguru adds the loguru backend: pip install "cotyper[loguru]". The old rich extra still installs but adds nothing. The yaml extra adds PyYAML so config files can be written in YAML.

pip install cotyper
uv add cotyper

From source

git clone https://gitlab.opencode.de/lgln/cotyper
cd cotyper
uv sync            # or: pip install .

To build a wheel:

uv build --wheel   # or, with the `build` dependency group: uv run --group build python -m build --wheel

Check the installation

python -c "import cotyper; print(cotyper.__version__)"
# 0.13.1.post1

Type checking

CoTyper ships a py.typed marker (PEP 561), so type checkers such as mypy, pyright and ty use its annotations when you import from cotyper.

Moving an existing Typer app to CoTyper

cotyper.App is a subclass of typer.Typer, so migrating takes two changes:

-import typer
-app = typer.Typer()
+from cotyper import App
+app = App()

-@app.command("train")
+@app.struct_command("train")
 def train(config: TrainConfig):
     ...

Commands that only use plain types can stay on @app.command. Sub-apps added with app.add_typer(...) work as usual.