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.0.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.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aceparse-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 c1fa9cba926adc8246b833d90f0e1c5c200cfe7421bb88c7bf50fca44593fb23
MD5 1bd91f1dc883c284451520bf5ecbdcbe
BLAKE2b-256 c6570c195ab06d7a8f2e706fa30db46bb6890b7b0ec4aa628510061a1d2cf634

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: aceparse-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54b0bd9be94c17d5e9a7a88e9312aa26b7416aac89ef54d3450236ffd73ef387
MD5 6df44cfecb9e92d53c8eb14b2c01dfb9
BLAKE2b-256 5c870385234038073cb5d71ffb70bb3790d8e81d9b4b1f4bfd9ebe3a02c15e96

See more details on using hashes here.

Provenance

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