Reversed argparse: generate string of command-line args from Python objects.
The argunparse is intended to perform an approximate reverse of what argparse does. In short: generating string (or a list of strings) of command-line arguments from a dict and/or a list.
How to use
Simple example of how argunparse works:
import argunparse
options = {
'v': True,
'long-flag': True,
'ignored': False,
'also-ignored': None,
'o': 'out_file.txt',
'log': 'log_file.txt'
}
args = {
'in_file.txt'
}
unparser = argunparse.ArgumentUnparser()
print(unparser.unparse(*args, **options))
# -v --long-flag -o=out_file.txt --log=log_file.txt in_file.txt
print(unparser.unparse_to_list(*args, **options))
# ['-v', '--long-flag', '-o=out_file.txt', '--log=log_file.txt', 'in_file.txt']
Special option values are:
True– option will be treated as a flag;FalseandNone– option will be ignored.
All other values will be converted to strings using str().
For more examples see examples.ipynb notebook.
Requirements
Python version 3.11 or later.
Python libraries as specified in requirements.txt.
Building and running tests additionally requires packages listed in requirements_test.txt.
Tested on Linux, macOS and Windows.
Installation
For simplest installation use pip:
pip3 install argunparse
Links
Metadata
Release files for argunparse 0.2.0
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 | Actions |
|---|---|---|---|---|
| argunparse-0.2.0.tar.gz | 10.8 kB | Without provenance | Details for argunparse-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| argunparse-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for argunparse-0.2.0-py3-none-any.whl |
Total release size: 20.2 kB
Release files / argunparse-0.2.0.tar.gz
| Download URL | argunparse-0.2.0.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a575ca43f98a72ade6c0a59ad843cfd19df7aacbe062d4d35a99c023036d1d1
|
|
BLAKE2b-256 checksum How to use checksums |
663cb64928efa2282589e7977c46a46192b709f710646ea8def55073702ee570
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / argunparse-0.2.0-py3-none-any.whl
| Download URL | argunparse-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
031dd2fff527a9ef96d299b4dc6c9dcadd2cc42e2aff01d2cb2c6c7e69a87aa0
|
|
BLAKE2b-256 checksum How to use checksums |
cf0a77c3e62ad282e769eb2941e04d94019bb65c4e51a2397b984610b3616735
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for argunparse 0.2.0
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.