Skip to main content

Overview

A lightweight wrapper around argparse to help build CLIs from functions.

PyPi Version Python Version PyPI License

Setup

:gear: Installation

Install it directly into an activated virtual environment:

$ pip install arger

:books: Usage

  • Create a Python file called test.py:
from arger import Arger


def main(param1: int, param2: str, kw1=None, kw2=False):
    """Example function with types documented in the docstring.

    Args:
        param1: The first parameter.
        param2: The second parameter.
        kw1: This is an optional parameter.
        kw2: This is a boolean. Setting the flag sets it to True.
    """
    print(locals())


arger = Arger(
    main,
    prog="pytest",  # for testing purposes; otherwise, not required
)

if __name__ == "__main__":
    arger.run()
  • Here Arger is just a subclass of ArgumentParser. It does not prevent you from using standard argparse features.

  • Run this normally with:

$ python test.py -h
usage: pytest [-h] [-k KW1] [-w] param1 param2

Example function with types documented in the docstring.

positional arguments:
  param1             The first parameter.
  param2             The second parameter.

optional arguments:
  -h, --help         show this help message and exit
  -k KW1, --kw1 KW1  This is an optional parameter. (default: None)
  -w, --kw2          This is a boolean. Setting the flag sets it to True. (default: False)
$ python test.py 100 param2
{'param1': 100, 'param2': 'param2', 'kw1': None, 'kw2': False}
  • Check out the examples folder and documentation to see more of arger in action. It supports any level of sub-commands.

Features

  • Uses the docstring to parse help descriptions for arguments. Supports:
  • Flags will be generated from parameter names.
    1. E.g., def main(param: ...) -> -p, --param
    2. If needed, you can declare them inside the docstring, like :param arg1: -a --arg this is the document.
  • One can use the Argument class to pass any values to the parser.add_argument function.
  • The decorated functions can be composed to form nested sub-commands of any level.
  • Most standard types are supported. Please see the examples for more supported types with code examples.
  • No external dependency other than the standard library.

NOTE

  • *args is supported, but there is no **kwargs support yet.
  • Any optional argument starting with an underscore is not passed to the parser. They are considered private to the function's implementation. Some parameter names have special meaning:
    • _namespace_ -> gets the output from ArgumentParser.parse_args()
    • _arger_ -> gets the parser instance

Argparser enhancements

Metadata

Release files for arger 2.2.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 arger 2.2.2
File Size Uploaded
arger-2.2.2.tar.gz 16.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for arger 2.2.2
File Interpreter ABI Platform
arger-2.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 28.4 kB

Release files / arger-2.2.2.tar.gz

Download URL arger-2.2.2.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c6c6d193637509919994ee8f8f73210156f120a5d171a8f0853f1133ff8a5547
BLAKE2b-256 checksum
How to use checksums
7c81044720b56417795e57d7e03f7dd25c5d7f80e4dac40991e5014e02244371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

Release files / arger-2.2.2-py3-none-any.whl

Download URL arger-2.2.2-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c40dabf608f2d2e36d39d789c2581b57af779a1c1061a1d21a2b70df2646cda
BLAKE2b-256 checksum
How to use checksums
68dc13b6b44f7f51a454c7e07ebb49b84fa05159e1f0aece64fa4e15f278f526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.2.2 This release

2 release files

2.2.1

2 release files

2.1.0

2 release files

2.0.2

2 release files

1.4.8

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.3.8

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.0

2 release files

1.2.9

2 release files

1.2.8

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

0.4.1

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1

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