Generate the effective command line invocation for a script.
Project description
reverse_argparse
Whereas argparse is concerned with taking a bunch of command line
arguments and parsing them, this package is intended to do the opposite; that
is, it'll take the parsed arguments and create the effective command line
invocation of the script that generated them. The motivation is to be able to
tell users exactly what was used for all of the options, taking into
consideration any defaults and other transformations that might've been applied
in the midst of parsing, such that users are able to reproduce a prior run of a
script exactly.
Installation
To get up and running with reverse_argparse, simply:
python3 -m pip install reverse-argparse
Usage
Once the package is installed, you can simply
from argparse import ArgumentParser
from reverse_argparse import ReverseArgumentParser
# Parse the command line arguments.
parser = ArgumentParser()
# Build out the parser however you like.
args = parser.parse_args()
# Optionally post-process any `args`, as needed.
# Do whatever you need to in the script.
# Wrap things up.
print("This script executed the following:")
unparser = ReverseArgumentParser(parser, args)
print(unparser.get_pretty_command_line_invocation())
For more detailed usage and API information, please see our documentation.
Where to Get Help
If you're having trouble with reverse_argparse, or just want to ask a
question, head on over to our issue board. If a quick search doesn't
yield what you're looking for, feel free to file an issue.
Contributing
If you're interested in contributing to the development of reverse_argparse,
we'd love to have your help :grinning: Check out our
contributing guidelines for how to get started.
Past contributors include:
License & Copyright
See LICENSE.md and COPYRIGHT.md.
Credits
Special thanks to @mjsumpter for contributing to a prior iteration of this concept, and to the GMS project for investing in the development of this package.
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 reverse_argparse-2.0.10.tar.gz.
File metadata
- Download URL: reverse_argparse-2.0.10.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71a92d8af8fb0ea3a5f1c2e4fb3aad8b12c7b52354190610eae2567b8bd27a87
|
|
| MD5 |
432697e9fae1e5f1e7a76621b74772ac
|
|
| BLAKE2b-256 |
d36de92ff855559aa88ed610d60daaf08797de3a90dd6557b9b8047a13ae1a24
|
Provenance
The following attestation bundles were made for reverse_argparse-2.0.10.tar.gz:
Publisher:
semantic-release.yml on sandialabs/reverse_argparse
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reverse_argparse-2.0.10.tar.gz -
Subject digest:
71a92d8af8fb0ea3a5f1c2e4fb3aad8b12c7b52354190610eae2567b8bd27a87 - Sigstore transparency entry: 624925522
- Sigstore integration time:
-
Permalink:
sandialabs/reverse_argparse@39fb94033d94830c942a6c5b9aa8461152981827 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/sandialabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
semantic-release.yml@39fb94033d94830c942a6c5b9aa8461152981827 -
Trigger Event:
push
-
Statement type:
File details
Details for the file reverse_argparse-2.0.10-py3-none-any.whl.
File metadata
- Download URL: reverse_argparse-2.0.10-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0de4b6c48ba816be91896778271ae9b444b49233d277df333e9d55ba56ec0b28
|
|
| MD5 |
7d088f3abc1f81b16cac14902bb520c5
|
|
| BLAKE2b-256 |
fde2b0bc1617e7fef99c08d18570ab96b38a17f6fd4f196c54548749b30ceeb9
|
Provenance
The following attestation bundles were made for reverse_argparse-2.0.10-py3-none-any.whl:
Publisher:
semantic-release.yml on sandialabs/reverse_argparse
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reverse_argparse-2.0.10-py3-none-any.whl -
Subject digest:
0de4b6c48ba816be91896778271ae9b444b49233d277df333e9d55ba56ec0b28 - Sigstore transparency entry: 624925573
- Sigstore integration time:
-
Permalink:
sandialabs/reverse_argparse@39fb94033d94830c942a6c5b9aa8461152981827 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/sandialabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
semantic-release.yml@39fb94033d94830c942a6c5b9aa8461152981827 -
Trigger Event:
push
-
Statement type: