Skip to main content

argdump

Serialize and deserialize Python argparse parsers.

Installation

pip install argdump
# or
uv add argdump

Usage

import argparse
import argdump

# Create a parser
parser = argparse.ArgumentParser(prog="mytool")
parser.add_argument("input")
parser.add_argument("-v", "--verbose", action="count", default=0)
parser.add_argument("--format", choices=["json", "csv"])

# Serialize
data = argdump.dump(parser)       # dict
json_str = argdump.dumps(parser)  # JSON string

# Deserialize
restored = argdump.load(data)
restored = argdump.loads(json_str)

# Use normally
args = restored.parse_args(["input.txt", "-vvv", "--format", "json"])

JSON Schema

A JSON Schema for validating serialized output is available at docs/schema-v1.json.

Features

  • All standard actions (store, append, count, etc.)
  • Subparsers with aliases and per-command help text
  • Mutual exclusion and argument groups
  • Type converters (builtins, FileType, importable functions)
  • Choices, defaults, metavar, help text
  • Environment metadata ($env) for reproducibility

Options

# Exclude environment metadata
argdump.dump(parser, include_env=False)

# Non-strict mode: skip unresolvable types instead of raising
argdump.load(data, strict=False)

Limitations

Lambdas and closures cannot be serialized. Use strict=False to skip them:

parser.add_argument("--value", type=lambda x: int(x) * 2)

argdump.load(argdump.dump(parser), strict=False)  # type becomes None
argdump.load(argdump.dump(parser), strict=True)   # raises UnresolvableTypeError

A mutually exclusive group nested inside a named argument group is reconstructed as a top-level mutex group: exclusivity is still enforced, but in --help its members appear under the default options heading rather than the named group.

License

MIT

Metadata

Release files for argdump 0.1.3

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

Source distribution (sdist)

Source distribution for argdump 0.1.3
File Size Uploaded Provenance
argdump-0.1.3.tar.gz 70.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for argdump 0.1.3
File Interpreter ABI Platform
argdump-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 88.1 kB

Release files / argdump-0.1.3.tar.gz

Download URL argdump-0.1.3.tar.gz
Size 70.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b63f71b10476be30c22c8927b82cf29cfedbbaba841cf236b107724acbc03b93
BLAKE2b-256 checksum
How to use checksums
a03eda29c64ad69fd0428b3ae227f25b4103f1e10d936743400d3b226b93014a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 17, 2026.

Transparency log

Release files / argdump-0.1.3-py3-none-any.whl

Download URL argdump-0.1.3-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
803c8cb83e325fbcd1091e33ee03de7a8ce3556ddf727e5eb79e1772c63f2f5b
BLAKE2b-256 checksum
How to use checksums
42383c85141c85d9253f0904a4b2cf9d779ffa4c25cc228cac1c9b7cb912cf9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 17, 2026.

Transparency log

Security for argdump 0.1.3

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for argdump-0.1.3.tar.gz

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 17, 2026.

Transparency log

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.

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