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 extra loguru adds a loguru logging backend: pip install "cotyper[loguru]". 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.15.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.15.0
File Size Uploaded Provenance Actions
cotyper-0.15.0.tar.gz 6.0 MB Without provenance Details for cotyper-0.15.0.tar.gz

Built distribution (wheel)

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

Total release size: 6.0 MB

Release files / cotyper-0.15.0.tar.gz

Download URL cotyper-0.15.0.tar.gz
Size 6.0 MB
Tags Source
SHA-256 checksum
How to use checksums
bd09f70cceac95ddef680276163822cd049eac2a13f98120eef907ca2af073b3
BLAKE2b-256 checksum
How to use checksums
c00bb06fb883ace401cd7419785e6df255518ab9d4e224f8228d3824564d5c46
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.15.0-py3-none-any.whl

Download URL cotyper-0.15.0-py3-none-any.whl
Size 53.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2691e60e82d4f3b4ec87592af9c87a52e7c66afd690595cc48869db3e85de8ce
BLAKE2b-256 checksum
How to use checksums
952cbed3dbb71824aed9c92726baf42cc457e1e0a2f08d02cdb2421b6a88206a
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.15.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