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

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.1
File Size Uploaded Provenance Actions
cotyper-0.15.1.tar.gz 97.8 kB Without provenance Details for cotyper-0.15.1.tar.gz

Built distribution (wheel)

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

Total release size: 151.3 kB

Release files / cotyper-0.15.1.tar.gz

Download URL cotyper-0.15.1.tar.gz
Size 97.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4e24c97d8efc5cf507d1a7c5a12a2ebed349719299148f2c98829fd8d7587031
BLAKE2b-256 checksum
How to use checksums
903d4e6902f8ca336f92d56e3579f8e003849e1c1c236699c5e905177db130a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL cotyper-0.15.1-py3-none-any.whl
Size 53.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c60ab1e554bb403b5f7d23abcb453fd8d1d3a2c9a9705d1b0dcd948fc07d81e9
BLAKE2b-256 checksum
How to use checksums
c4edc76eb237c5b939d1fc1ca2911ccf1472a55fbb7009ea5e4132af1e0cfff5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for cotyper 0.15.1

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