Skip to main content

configure argparse from function signature

Project description

Makefile CI


argparse_action aims to be a minimalistic extension of argparse and creates cli options from the function signature given by inspect.signature.

import argparse
import argparse_action

parser = argparse.ArgumentParser()
action = argparse_action.Action(parser)

def echo(word, upper=False):
    print(word.upper() if upper else word)

namespace = parser.parse_args()

Asumes that the code above is saved as

$ python3 echo hello

$ python3 e hello

$ python3 echo --upper hello


pip install argparse_action


make dev

CI check

The check make target collects the targets which are run by the CI server.

make check


The test target requires a virtulenv where argparse_action is installed. The dev target creates that virtualenv under .venv directory.

make test


The argparse_action project is formatted with black. The CI check invokes the check-format target to ensure that the python files are formatted with black.

make check-format

black can be run with the format make target.

make format


The lint target runs pylint over the argparse_action project.

make lint


Documentation can be build with the doc make target. To ensure the documentation build tools the make dev has to be executed once before make doc.

make doc

Online version can be read at

Project details

Download files

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

Source Distribution

argparse_action-0.5.2.tar.gz (8.9 kB view hashes)

Uploaded Source

Built Distribution

argparse_action-0.5.2-py3-none-any.whl (9.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page