an easy-to-integrate typed argument parser
Project description
Argparse Type Helper
A lightweight helper that lets you leverage type hints with argparse.
Features
- Class-based schema
Bundle all your arguments in a single
@targs-decorated class. - Identical API
Each field uses the same parameters as
argparse.add_argument(help,action,nargs, etc.). - Automatic registration
One call to
register_targs(parser, YourArgs)wires up all arguments on yourArgumentParser. - Typed extraction
After
parse_args(), callextract_targs()to get a fully-typed instance of your class. - Hybrid usage
Mix native
parser.add_argument(...)calls with class-based definitions in the same parser. - Docstring support Use docstrings to automatically generate help text for your arguments.
Installation
pip install argparse-type-helper
Usage
See example.py.
Why not typed-argparse?
typed-argparse is a great library, but it replaces the familiar argparse.add_argument API with its own argument-definition interface, which can be a hurdle when integrating into an existing codebase.
argparse-type-helper, by contrast, is a simple helper that allows you to use type hints with argparse with minimal learning curve. It uses the same argparse API you’re already familiar with, and you can even mix native argparse usage with class-based definitions in the same parser.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file argparse_type_helper-0.1.0.tar.gz.
File metadata
- Download URL: argparse_type_helper-0.1.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cafb0e6c82f6484ed0183d028006b3df6a6bf565aa54c90cc289cf143706c871
|
|
| MD5 |
7d1f96722ef1605460ca7c28cce09110
|
|
| BLAKE2b-256 |
874647424fc25a2940dfc7ccee49f2021fec95852b20efda7123ed5a9c1e73c8
|
Provenance
The following attestation bundles were made for argparse_type_helper-0.1.0.tar.gz:
Publisher:
publish.yml on lljbash/argparse-type-helper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
argparse_type_helper-0.1.0.tar.gz -
Subject digest:
cafb0e6c82f6484ed0183d028006b3df6a6bf565aa54c90cc289cf143706c871 - Sigstore transparency entry: 271342016
- Sigstore integration time:
-
Permalink:
lljbash/argparse-type-helper@562dd39addb7585c9d9305c1dc9aa6435d737468 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/lljbash
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@562dd39addb7585c9d9305c1dc9aa6435d737468 -
Trigger Event:
push
-
Statement type:
File details
Details for the file argparse_type_helper-0.1.0-py3-none-any.whl.
File metadata
- Download URL: argparse_type_helper-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a16f1e65a498efcd50cedb282cfad6d95dd5441392dc86bf4abd6297462dba11
|
|
| MD5 |
35f5f1cff65b7122815f3fbc028f2280
|
|
| BLAKE2b-256 |
0b0765c836fb981974095fd4a126cc53da39cb5ffceb1f074120a85e9252fc7f
|
Provenance
The following attestation bundles were made for argparse_type_helper-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on lljbash/argparse-type-helper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
argparse_type_helper-0.1.0-py3-none-any.whl -
Subject digest:
a16f1e65a498efcd50cedb282cfad6d95dd5441392dc86bf4abd6297462dba11 - Sigstore transparency entry: 271342029
- Sigstore integration time:
-
Permalink:
lljbash/argparse-type-helper@562dd39addb7585c9d9305c1dc9aa6435d737468 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/lljbash
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@562dd39addb7585c9d9305c1dc9aa6435d737468 -
Trigger Event:
push
-
Statement type: