Skip to main content

argparse-utilities

Actions and other utility functions for use with argparse

Quickstart

Install from pip:

pip install argparse-utilities

Usage

import argparse
from argparse_utilities import StoreMaxOneAction

parser = argparse.ArgumentParser(
    prog='Foo',
    description='foo foo foo',
)

parser.add_argument(
    '-f', '--foo',
    action=StoreMaxOneAction,
    type=int,
    required=True,
)

x = parser.parse_args(['--foo', '1'])
# x will be argparse.Namespace(foo=1)

parser.parse_args(['--foo', '1', '--foo', '2'])
# will throw ValueError('--foo supplied more than once')

Development

For those developing or maintaining the argparse-utilities package itself, be sure to install it with the [dev] option to pull in packages used when developing.

pip install --editable .[dev]

When developing, this package uses pre-commit. After the initial clone of the repository, you will need to set up pre-commit with:

# in the top level of the checked-out repository:
pre-commit install

Changelog

0.0.2 released 2023-11-09

  • Initial Version

Release files for argparse-utilities 0.0.2

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

Source distribution (sdist)

Source distribution for argparse-utilities 0.0.2
File Size Uploaded
argparse-utilities-0.0.2.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for argparse-utilities 0.0.2
File Interpreter ABI Platform
argparse_utilities-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / argparse-utilities-0.0.2.tar.gz

Download URL argparse-utilities-0.0.2.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8e7c409489c78ec3ba3900cc0615707dcd5924f3039a9cc05915c6fb50c76cc2
BLAKE2b-256 checksum
How to use checksums
994be2b111b0602e4c4fd33e55a05d9597f7270c9e9aeed8baed576151d8046a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / argparse_utilities-0.0.2-py3-none-any.whl

Download URL argparse_utilities-0.0.2-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71055cd6a06ca717efb7a5140c51b844d5b1cf4005175c9707f503664d8c6786
BLAKE2b-256 checksum
How to use checksums
a6b73ac0ec4c25e91e4ac87e73d49fcec3580ee44d8dc214cfaed6bb024fb81f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

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