Declarative Argparse
This project introduces a wrapper argound the built-in argparse module that permits one to make a declarative parser for options.
[[TOC]]
Example
import argparse
from declarative_argparse import DeclarativeOptionParser
from declarative_argparse.options.int import IntDO
from declarative_argparse.options.str import StrDO
class DAPExample(DeclarativeOptionParser):
def __init__(self) -> None:
super().__init__(argp=argparse.ArgumentParser())
self.x: IntDO = self.addInt('--x', '-x', description='X coordinate')
self.y: IntDO = self.addInt('--y', '-y', description='Y coordinate')
self.name: StrDO = self.addStr('--name', description='Change tile name').setNArgs('?')
self.id: StrDO = self.addStr('id', description='specify tile ID')
# ...
args = DAPExample()
args.parseArguments(['--x=0', '-y', '1', 'abc1'])
assert args.x.get_value() == 0
assert args.y.get_value() == 1
assert args.name.get_value() is None
assert args.id.get_value() == 'abc1'
License
MIT
Contributions are always welcome.
Metadata
Release files for declarative-argparse 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| declarative_argparse-0.0.8.tar.gz | 5.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| declarative_argparse-0.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.7 kB
Release files / declarative_argparse-0.0.8.tar.gz
| Download URL | declarative_argparse-0.0.8.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5deb1f0f47ab38a0dbccb65ef9c941a0da63035c2e335444d4df988445a9b238
|
|
BLAKE2b-256 checksum How to use checksums |
936d3b1cc14ee28a586b32f3a7d75f03bda051bb89d89c6d20867fc1bc8edddb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / declarative_argparse-0.0.8-py3-none-any.whl
| Download URL | declarative_argparse-0.0.8-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
419bacfb59035b9ee05f50928598fed435951c35b7fa7b664f4c70e3cab5c57b
|
|
BLAKE2b-256 checksum How to use checksums |
65684163b855834555900efb877ef6874b10165240367a9bd49268ea23a630c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for declarative-argparse 0.0.8
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.