Skip to main content

Aga is a lightweight native Python library for quickly creating documented command-line interfaces using argparse. It is designed to be as simple as possible to use.

Usage

Using Aga couldn't be easier. Assume the file below is named test.py:

from aga import *


@aga.add_arg
def add(first: int, second: int = 2) -> int:
    """ A simple function to add two numbers

    Args:
        first: One of the numbers to add
        second: The other number to add

    Returns:
        first added to second
    """

    return x + y


if __name__ == '__main__':
    aga.bake()
    print(aga.args.first, aga.args.second)

This simple file will result in the x and y arguments as shown below in the output of python test.py -h.

❯ python test.py -h
usage: test.py [-h] [-s] [-f]

options:
  -h, --help      show this help message and exit
  -s , --second   The other number to add
  -f , --first    One of the numbers to add

As you can see, one must simply add the decorator aga.add_arg to a function and Aga will parse the function definition and create a documented command-line interface.

Aga will search for PEP484 type annotations, default values and Google-style docstrings to add further information to the argument definition. None of these are necessary however, and if one (or all) are missing it will simply be ignored.

Release files for py-aga 0.1.4

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

Source distribution (sdist)

Source distribution for py-aga 0.1.4
File Size Uploaded
py_aga-0.1.4.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-aga 0.1.4
File Interpreter ABI Platform
py_aga-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / py_aga-0.1.4.tar.gz

Download URL py_aga-0.1.4.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3c085223ce653e106d879a6a4bd484ec29b3d5cbe858cb0d3ccb275f68c2ebb9
BLAKE2b-256 checksum
How to use checksums
7b6bcf18e77d2afd73b7b85a3b2fca6ef946356237e48ebfc42f0637305e31b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / py_aga-0.1.4-py3-none-any.whl

Download URL py_aga-0.1.4-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c924caeecbd78e97d4becf11a49531399ec34ac2869296234421b3848401a62e
BLAKE2b-256 checksum
How to use checksums
6f6361b467ff82e3f418fa40c20dabf3c05aff2f819d372ecccc3391c405bedf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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