Skip to main content

CoTyper

CI Status Coverage Docs PyPI Downloads

CoTyper turns functions that take (nested) Pydantic models into Typer command line interfaces. Every model field becomes its own option, and the parsed values are folded back into validated model instances before your function is called.

CoTyper, since you add a lot of co in category theory.

📖 Documentation: https://cotyper-065160.usercontent.opencode.de/

Installation

pip install cotyper
# or
uv add cotyper

The optional extras rich and loguru add logging backends, e.g. pip install "cotyper[rich]". See Installation for building from source.

Quick start

from pydantic import BaseModel
from cotyper import App

app = App()


class Database(BaseModel):
    host: str = "localhost"
    port: int = 5432


@app.struct_command("connect")
def connect(db: Database):
    print(f"Connecting to {db.host}:{db.port}")


if __name__ == "__main__":
    app()
$ python app.py --db-host example.org --db-port 6543
Connecting to example.org:6543

Learn more

  • Tutorial – build a CLI step by step
  • Guide – naming rules, supported types, config files, unfold_cls, optional and list fields, logging
  • API Reference
  • examples/ – runnable scripts, e.g. uv run examples/extensive.py --help

Development

uv run pytest                                  # run the tests
uv run --only-group docs mkdocs serve          # preview the docs locally

See CONTRIBUTING.md for details on how to contribute.

License

MIT License

Metadata

Release files for cotyper 0.13.1.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cotyper 0.13.1.post1
File Size Uploaded Provenance Actions
cotyper-0.13.1.post1.tar.gz 1.4 MB Without provenance Details for cotyper-0.13.1.post1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cotyper 0.13.1.post1
File Interpreter ABI Platform Actions
cotyper-0.13.1.post1-py3-none-any.whl Python 3 none any Details for cotyper-0.13.1.post1-py3-none-any.whl

Total release size: 1.5 MB

Release files / cotyper-0.13.1.post1.tar.gz

Download URL cotyper-0.13.1.post1.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
11d323274a15f81672e205a58ca2efbbe404f422c6db52228af6b8b60cdcc841
BLAKE2b-256 checksum
How to use checksums
ba1d867bd8534ae2cbf959f229bd2cec62f2f405305ce9b09a8a29d82f9efe72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / cotyper-0.13.1.post1-py3-none-any.whl

Download URL cotyper-0.13.1.post1-py3-none-any.whl
Size 42.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b0763001d559be374826b4b0ccccf86e61f6f998d3d971a2df32fc77b59458b
BLAKE2b-256 checksum
How to use checksums
cf836c838829a1de871353444bc375013be9e6804b156586434045608fb959bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Security for cotyper 0.13.1.post1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page