ordered_argparse
Version of Python's standard library's argparse which also remembers the order of command line arguments.
Installation
Install with pip install ordered_argparse.
Usage
Create an instance of ArgumentParser as usual. Use namespace=ordered_argparse.OrderedNamespace(). Access arguments in declaration order by calling parser's .ordered() method.
import ordered_argparse
parser = ordered_argparse.ArgumentParser()
parser.add_argument("--foo", action="store_true", help="foo")
parser.add_argument("--bar", action="store_true", help="bar")
# Use OrderedNamespace when parsing CLI arguments
args = parser.parse_args(["--foo", "--bar"], namespace=ordered_argparse.OrderedNamespace())
# Access ordered arguments by calling .ordered()
for arg in args.ordered():
print(f"{arg}")
Compatibility with argcomplete
ordered_argparse only works with argcomplete as long as you don't use subparsers. If you use subparsers, you need ordered_argcomplete.
Metadata
Release files for ordered-argparse 1.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ordered_argparse-1.0.10.tar.gz | 26.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ordered_argparse-1.0.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.3 kB
Release files / ordered_argparse-1.0.10.tar.gz
| Download URL | ordered_argparse-1.0.10.tar.gz |
|---|---|
| Size | 26.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a930c290552e221b53cdfe2c832fce2e83031e403ceb1084b4a00b3e00155a73
|
|
BLAKE2b-256 checksum How to use checksums |
1e2a0b8b6e33385a4a2da6621cf03d6113818b97dde0a25c38f83db5ac06f577
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
|
Release files / ordered_argparse-1.0.10-py3-none-any.whl
| Download URL | ordered_argparse-1.0.10-py3-none-any.whl |
|---|---|
| Size | 25.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c960dc733b1ee8a5fe1d7134596fbb98cf7a99b4648b78aa4f2179153d4c58b
|
|
BLAKE2b-256 checksum How to use checksums |
054e4963f928549cc8aab500196884296633ae9a6b7d9f7cd7a1cf55b6c83a36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
|