Skip to main content

autoarg

a simple tiny wrapper of argument parser

  • There are already pairs of optional keywords and default values and types in function signature, and docstring as a description. just use it!

  • no more verbose code for command line options :)

write sample.py

# sample.py

def main(pos1, pos2, kw1=1, kw2=2):
    """
    dostring as a help string
    :param pos1:
    :param pos2:
    :param kw1:
    :param kw2:
    :return:
    """
    pass


if __name__ == '__main__':
    import autoarg
    autoarg.run(main)

just run

$ python sample.py -h

$ python sample.py --help
usage: sample.py [-h] [--kw2 KW2] [--kw1 KW1] pos1 pos2

    dostring as a help string
    :param pos1:
    :param pos2:
    :param kw1:
    :param kw2:
    :return:


positional arguments:
  pos1
  pos2

optional arguments:
  -h, --help  show this help message and exit
  --kw2 KW2   kw2 : default = 2
  --kw1 KW1   kw1 : default = 1

if you need complex one, consider python-fire

Metadata

Release files for autoarg 0.0.4.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 autoarg 0.0.4.2
File Size Uploaded Provenance Actions
autoarg-0.0.4.2.tar.gz 3.7 kB Without provenance Details for autoarg-0.0.4.2.tar.gz

Release files / autoarg-0.0.4.2.tar.gz

Download URL autoarg-0.0.4.2.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4e723f002bade423d536d8f6043f97398de70f405b94a74668a672386762c7bb
BLAKE2b-256 checksum
How to use checksums
5299820b731110b4587d88ad8acba7ca9ecff8969f8ea204505f7eeceedc4025
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for autoarg 0.0.4.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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