Skip to main content

Decorators and wrapper for easily define script's arguments within functions and classes. just defining function's args.

Project description

ArgParseInator

Argparseinator is a silly, but useful, thing that permit you to easily add argparse’s arguments and options to your script directly within functions and classes with the use of some decorators.

Install

pip install argparseinator

Quick example (sayciao.py module)

"""
Say ciao script.
"""

__version__ = "1.2.3"


from argparseinator import ArgParseInator, arg


@arg()
def sayciao(name):
    """
    I will say ciao.
    """
    print "Ciao", name

if __name__ == '__main__':
    ArgParseInator().check_command()

call:

$ python sayciao.py --help

will output:

usage: sayciao.py [-h] [-v] name

Say ciao script.

    I will say ciao.


positional arguments:
  name

optional arguments:
  -h, --help     show this help message and exit
  -v, --version  show program's version number and exit

call:

$ python sayciao.py --version

will output:

sayciao.py 1.2.3

call:

$ python sayciao.py luca

will output:

Ciao luca

Docs

See readthedocs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ArgParseInator-1.3.0-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file ArgParseInator-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: ArgParseInator-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2

File hashes

Hashes for ArgParseInator-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b70bc2286bcdb053e13a551a2aaf30d64ae4be64cecbe4cc4e73c142d2243b7
MD5 b74e8737b08263198a462dc386d4fb4c
BLAKE2b-256 59bafd905fa2e9dd65bb1ed44a6292afdc1cc6a1274bc4caa53f4e907c0337ab

See more details on using hashes here.

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