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.14.0

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.14.0
File Size Uploaded Provenance Actions
cotyper-0.14.0.tar.gz 29.8 MB Without provenance Details for cotyper-0.14.0.tar.gz

Built distribution (wheel)

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

Total release size: 29.8 MB

Release files / cotyper-0.14.0.tar.gz

Download URL cotyper-0.14.0.tar.gz
Size 29.8 MB
Tags Source
SHA-256 checksum
How to use checksums
1bd81c0ac7c7ab4453fe3aac7016d4fc6f49d0dd9f792785b5c170514c094b23
BLAKE2b-256 checksum
How to use checksums
6bfa7c85b1070dd63d3f689396d301088ad8ae0f37d7262c2f8263e0e20bc4fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / cotyper-0.14.0-py3-none-any.whl

Download URL cotyper-0.14.0-py3-none-any.whl
Size 42.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d429c7cbd17a7367e55f94a04153f2ca05a2fbcf0d27cca9a87d1eb16af0225
BLAKE2b-256 checksum
How to use checksums
6556047a629688f24b13c4670a883ce85e9fddad87ad6bc309af7ca44180f184
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Security for cotyper 0.14.0

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