Skip to main content

protocli

pypi

Signature-driven CLI dispatcher: typed function signatures become argparse parsers, modules become lazily-imported subcommands, with nested dispatch, --help-all and shell completions.

# mytool/__main__.py
from protocli import Dispatcher

Dispatcher(
    "mytool",
    {
        "greet": greet,          # a callable: its signature IS the parser
        "db": "mytool.db",       # a module path: lazy-imported on dispatch
    },
).run()

A callable (or a module's main) maps to CLI arguments by signature:

def greet(
    name: str,                        # required positional
    title: str | None = None,         # optional positional
    *rest: str,                       # variadic
    loud: bool = False,               # --loud   (keyword-only, default False)
    times: int = 1,                   # --times N
    lang: Literal["en", "hu"] = "en", # --lang restricted to choices
    tags: list[str] = [],             # --tags a,b,c  (comma-separated)
): ...

A module can instead expose its own nested _dispatcher = Dispatcher(...), or a get_completions(rest) hook for custom shell completion (return [FILE_COMPLETION] to request native pathname completion).

mytool --help-all prints every parser in the tree; mytool --complete <args…> emits completion candidates for shell integration.

Auto-discovery over a package's public modules:

Dispatcher.from_package("mytool").run()

Release files for protocli 0.1.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 protocli 0.1.1
File Size Uploaded
protocli-0.1.1.tar.gz 8.3 kB Details

Built distribution (wheel)

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

Total release size: 17.0 kB

Release files / protocli-0.1.1.tar.gz

Download URL protocli-0.1.1.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a9e87a35f04914d2e83f1a2f577cacfb8931fadbda0e6930b512bd62a00e6d68
BLAKE2b-256 checksum
How to use checksums
ba1f2348548278158b7e97ecfa3eb4e59015488549760caa8be65a83121ad7ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / protocli-0.1.1-py3-none-any.whl

Download URL protocli-0.1.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d573599f5fc4678fbee732e545147ca3348bb9ab7adc5cad36f0db1a510cb99
BLAKE2b-256 checksum
How to use checksums
731b021246a4e7751cb59933ad025dfe281dbdf5f7c078409d23a1adaeaa647c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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