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.1.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.1.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aceparse-0.1.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.8

File hashes

Hashes for aceparse-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4a00959d864da2b942b296d71c8fa658aafa9e7ef447f145ff7f56364f305bce
MD5 9803a7f5a1038b4a18c4c94f1a2509fb
BLAKE2b-256 7c21690d20f973b654e79fedf44a1416c7eb582acb968d317639c104014f49e7

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for aceparse-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8cdd221482ab9771ec80ebc6b7b7ccda996d5295fef15ee755d04a0016f0bb43
MD5 dc5ec41bb00e9fbc67b77d9c21aba2d1
BLAKE2b-256 bc3490449a81d2ba8f8b2ab613d5e63ca858de8535c4c2ec1f28b18a99656bdb

See more details on using hashes here.

Provenance

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