typed-cap
Cap is a python Command-line Argument Parser that provides typing support. Using Cap requires less code to generate a more easy to use parser.
Usage
⚠️ typed_cap required python>=3.9
pip install typed_cap
Quick Example
from typed_cap import Cap
class Args:
"""description here"""
# @alias=c
config: str | None
"""file path to config file"""
# @alias=d
depth: int
"""depth of search"""
dry_run: bool = True
"""run without making any changes"""
cap = Cap(Args)
parsed = cap.parse()
print(parsed.args.__dict__)
print(parsed.argv)
python demo.py
# Cap.parse: option depth:int is required but it is missing
# ArgsParserMissingArgument
python demo.py --help
# description here
#
# OPTIONS:
# -c,--config file path to config file
# -d,--depth depth of search
# --dry_run run without making any changes (default: True)
# -h,--help display the help text
python demo.py -d 5 hello typed cap
# {'depth': 5, 'config': None, 'dry_run': True}
# ['hello', 'typed', 'cap']
Metadata
Release files for typed-cap 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| typed_cap-0.3.1.tar.gz | 526.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| typed_cap-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 555.7 kB
Release files / typed_cap-0.3.1.tar.gz
| Download URL | typed_cap-0.3.1.tar.gz |
|---|---|
| Size | 526.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9bf960e54e2dc5b543593ad27f6ee9a2b112fac9b1921b3224be3eb737263cc5
|
|
BLAKE2b-256 checksum How to use checksums |
c14476a92c64fcee3180ccac00e8bbb55225e7024d24ec0a512ab02cb99d6c07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / typed_cap-0.3.1-py3-none-any.whl
| Download URL | typed_cap-0.3.1-py3-none-any.whl |
|---|---|
| Size | 29.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbc5992238b097888b64a65ecb84dea92eb2daa2fdc533899e571c3ee3f902fb
|
|
BLAKE2b-256 checksum How to use checksums |
ea830b5d2008f1e3bb0d69470bc3bdcfac23409ebbc673ed1dd03bd7a4b2a26a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|