Skip to main content

Improved argparse.ArgumentParser that works with dataclasses

Project description

aceparse

An argument parser that wraps python's built-in argparse, allowing it to parse command lines into dataclasses.

Advantages over argparse:

  • you get a dataclass so you can use an IDE to find out where your command line options are used
  • nicer specification of default values
  • can be combined with pydantic dataclasses to type check arguments

Examples

from dataclasses import dataclass
from aceparse import AceParser, AceArg

@dataclass
class Arguments:
    hello: str = AceArg(help="Name of thing to say hello to")

a = AceParser(Arguments)
args = a.parse_args_into_dataclasses(["--hello=name"])

print(f"Hello {args.hello}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aceparse-0.2.1.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aceparse-0.2.1-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file aceparse-0.2.1.tar.gz.

File metadata

  • Download URL: aceparse-0.2.1.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aceparse-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c1c21d8a60708be06f5521f06e733a63f9e2cb5aeda308693e11247b13ae9aec
MD5 b4e71e2bf4f4708cacc90823c5574396
BLAKE2b-256 9b169d9ec64c65529822b4ffd4547cda0ece7db0ba67b4aee402fe8f124563f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for aceparse-0.2.1.tar.gz:

Publisher: publish-to-pypi.yml on jjjamie/aceparse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aceparse-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: aceparse-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aceparse-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e39d85a7cf91be5fd20ba86b859b2d628103fdf71491513bd7a624d5aa1a8b9c
MD5 b8843e15ab5f1980d3595271a62b0199
BLAKE2b-256 15e7d6d9dac2fbc0f4b03443aa4da6714a511f4f3976b73f6af206eda41285f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for aceparse-0.2.1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on jjjamie/aceparse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page