Skip to main content

without-cli

Command-line parsing as values. A token is one declaration that is the parse, the help entry, and the typed read at once; a command is a value you can pass around rather than a decorator's side effect; and parsing is a pure function from argv to an outcome, so nothing is registered anywhere and nothing exits out from under you.

@dataclass(frozen=True, slots=True)
class Session(Streams):
    client: Client


@command("add", argument("text", once(STR)), option(("-t", "--tag"), many(STR)), summary="Add a todo.")
async def add(session: Session, text: str, tags: tuple[str, ...]) -> int:
    todo = await session.client.create(text, tags)
    session.stdout.write(f"{todo.id}\n")
    return 0


app = group("todos", verbose, endpoint, state=session, commands=(add, show, db))

if __name__ == "__main__":
    raise SystemExit(run(app))

state is an async context manager, entered only when something beneath it is selected, so every command receives a live client it did not open and does not close, typed and checked, with no ambient context object. There is no separate root concept: the top of a tree is an ordinary group whose parent is the shell, which supplies the Streams it derives from, so a CLI with no shared resource declares no state and its commands take that Streams directly. An option can name where else its value may come from (sources=(FromFile(...), FromEnv(...))), which covers environment variables and Kubernetes or Docker secret mounts through the same validation the command line goes through.

Help is a Usage value that plain text is one rendering of, so no styling library sits on the path every program crosses and this package depends on nothing. The streams are injected, so a test asserts on output by passing Streams.captured(), with no subprocess and no runner.

See the without-cli guide (with the API reference) for the full surface, including what is deliberately absent, and alternatives for the same program written against argparse, click, and typer.

Release files for without-cli 0.0.8

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

Source distribution (sdist)

Source distribution for without-cli 0.0.8
File Size Uploaded
without_cli-0.0.8.tar.gz 24.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for without-cli 0.0.8
File Interpreter ABI Platform
without_cli-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 54.4 kB

Release files / without_cli-0.0.8.tar.gz

Download URL without_cli-0.0.8.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cbf39e1412cfdba621dc9d0e23be7edb192e086029c490631a96b378216aa366
BLAKE2b-256 checksum
How to use checksums
bfa7adf130520ddc5cd48aa2d57fe47fb7d935d6d2509b8c07f27aa5eaf8a2da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","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 / without_cli-0.0.8-py3-none-any.whl

Download URL without_cli-0.0.8-py3-none-any.whl
Size 29.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09e0ff10a461ab186a81cf4e3c6c9b156a1c762f3155537b29250000d7ce13e9
BLAKE2b-256 checksum
How to use checksums
8585cd94d6cbde4fdbd6903e25b1994f95209cb985e37d3cc682bd7fec396fa0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","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.0.9

2 release files

This release

0.0.8 This release

2 release files

0.0.7

2 release files

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