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.2.tar.gz (21.3 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.2-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aceparse-0.2.2.tar.gz
  • Upload date:
  • Size: 21.3 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.2.tar.gz
Algorithm Hash digest
SHA256 ebcdb03ca2c054cc2b0ebf3e1d26c3b56cef228c3866bc79375096de0a6aa30a
MD5 259a3dbefd64f5be9e481a7fb8af2a5d
BLAKE2b-256 4f7332bd0f091baca94fa88b1cc9861efc0664629013e55870e941b2d47bcf05

See more details on using hashes here.

Provenance

The following attestation bundles were made for aceparse-0.2.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: aceparse-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 14.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a4b0aa36eb425b6c64db6c01e86ae77cbe53bfa54f0a186ea161879acd075d22
MD5 cc0a9f55ce3dcb051300034f66cd1240
BLAKE2b-256 9f9adc6293e8eb8be99e3135f4af2543803bf5725218faa57e20bbf9efe0704a

See more details on using hashes here.

Provenance

The following attestation bundles were made for aceparse-0.2.2-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