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

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.7
File Size Uploaded
without_cli-0.0.7.tar.gz 24.7 kB Details

Built distribution (wheel)

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

Total release size: 54.4 kB

Release files / without_cli-0.0.7.tar.gz

Download URL without_cli-0.0.7.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
30a88b37ab64469f9339ec337e3637a06b23f86073e08271cecf1b2592983b30
BLAKE2b-256 checksum
How to use checksums
f71ea20f5bdabef28a6dfa4a72b43a07ee70036708e888b73032af6ef86bb9a2
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.7-py3-none-any.whl

Download URL without_cli-0.0.7-py3-none-any.whl
Size 29.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac0780638b30b842d9cc492dc035684e1cfa8befc5b74847b94f5597f6d361b8
BLAKE2b-256 checksum
How to use checksums
bebd7abfc896ef6286060974fe21c21c8c5bc84d82e69cb52369f6bff9dde7c0
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

0.0.8

2 release files

This release

0.0.7 This release

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