Skip to main content

Lines of code codecov CodeFactor CodeQL Conda Version Conda Downloads Continuous Integration Contributor Covenant GitHub contributors Documentation Status License Merged PRs OpenSSF Best Practices OpenSSF Scorecard Platforms pre-commit pre-commit.ci Status PyPI - Version PyPI - Downloads Python Version Ruff

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.

Metadata

Release files for reverse-argparse 2.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reverse-argparse 2.0.11
File Size Uploaded
reverse_argparse-2.0.11.tar.gz 10.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for reverse-argparse 2.0.11
File Interpreter ABI Platform
reverse_argparse-2.0.11-py3-none-any.whl Python 3 none any Details

Total release size: 20.0 kB

Release files / reverse_argparse-2.0.11.tar.gz

Download URL reverse_argparse-2.0.11.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
866a37d49aa46383e6af045daf93202c58f4448b4f8a205d069aa71f3ef13188
BLAKE2b-256 checksum
How to use checksums
1b13d0d266212be5da8a4a7d6827f8fc81a740da236d1582bc4b700e5fe77521
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.

Transparency log

Release files / reverse_argparse-2.0.11-py3-none-any.whl

Download URL reverse_argparse-2.0.11-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f81f4127a587d6d311f57a3c2e8b3f14c800e0f688d915201733f9b2b1e43c4
BLAKE2b-256 checksum
How to use checksums
50c110f97e5096b3d3283fa0565a042facbf0ad3d2b771404403346d96f180eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.11 This release

2 release files

2.0.10

2 release files

2.0.9

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page