Skip to main content

clap-python

Command Line Argument Parser for Python

License PyPi

Licensed under Apache 2.0.

About

A full-featured, fast Command Line Argument Parser for Python

For more details, see:

Quick Start

pip install clap_python
from clap_python import App, Arg

app = (
    App()
    .version("0.1.0")  # Version of the app.
    .arg_required_else_help(True)  # If no args passed show help message.
    .arg(Arg("--name", "-n").help("Name of the person to greet").required(True))
    .arg(
        Arg("--count", "-c")
        .help("Number of times to greet")
        .default(1)
        .value_parser(int)  # tell the parser to cast arg to int.
    )
)

if __name__ == "__main__":
    args = app.parse_args()
    for _ in range(args["count"]):
        print(f"Hello {args['name']}!")

Positionals

from clap_python import App, Arg

if __name__ == "__main__":
    args = App().arg(Arg("names").multiple_values(True)).parse_args()
    print(f"names: {args['names']}")

Autocomplete

from clap_python import App, Arg
from clap_python.complete import autocomplete

app = App().arg(Arg("-c")).arg(Arg("--files").multiple_values(True))
autocomplete(app) # Enable autocompletion
args = app.parse_args() # Parse arguments
print(args)

You can read more at docs

Metadata

Release files for clap-python 0.2.4

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

Source distribution (sdist)

Source distribution for clap-python 0.2.4
File Size Uploaded Provenance Actions
clap_python-0.2.4.tar.gz 37.2 kB Without provenance Details for clap_python-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for clap-python 0.2.4
File Interpreter ABI Platform Actions
clap_python-0.2.4-py3-none-any.whl Python 3 none any Details for clap_python-0.2.4-py3-none-any.whl

Total release size: 61.7 kB

Release files / clap_python-0.2.4.tar.gz

Download URL clap_python-0.2.4.tar.gz
Size 37.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a8be0b9269009267aa333f73f5c8b957a1ad2f3267f2b939233552dd5e6afbde
BLAKE2b-256 checksum
How to use checksums
7ac2e371c898f94d17764b9e9baf0eb7ef4b50590b01853726a42a9e1a179bf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.9

Release files / clap_python-0.2.4-py3-none-any.whl

Download URL clap_python-0.2.4-py3-none-any.whl
Size 24.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79bb93ebb387256414e2af8a6932defa53cd1514ccd19fd979e4fa74960f986b
BLAKE2b-256 checksum
How to use checksums
16844184a25859680c42b3b5f7c55929558a5dc3ad466db7e14df3cde49702eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.9

Security for clap-python 0.2.4

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