Skip to main content

Command line arguments. Made simple.

Project description


Do you belong to those who have to look up the calls you have to make to argparse? And are you longing for a way to just import the parsed arguments as you would import sys.argv? Then cli-args is the way to go!

cli-args is a Python library for an easier parsing of command line arguments. It wraps the popular argparse to allow importing parsed arguments from anywhere in the code. One of the key features is the way you define what arguments you accept. By providing a dictionary - that also can be read from a JSON file! - you can easily set all available command line arguments at one specific, easy-to-find place.

Get it!

pip install cli-args

Use it!

import cli_args

# or: cli_args.from_file('path/to/schema.json')
    "description": "Process some integers.",
    "arguments": [
            "short": "a",
            "long": "integer_a",
            "var": "NUMBER",
            "help": "The first integer",
            "default": 0,
            "type": "int"
            "short": "b",
            "long": "integer_b",
            "var": "NUMBER",
            "help": "The second integer",
            "default": "0",
            "type": "int"

print(cli_args.argv['integer_a']) # 3
print(cli_args.argv['integer_b']) # 5

python --integer_a=3 --integer_b=5


Licensed under the MIT License. Happy forking :)

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

cli-args-1.0.1.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

cli_args-1.0.1-py3.9.egg (3.8 kB view hashes)

Uploaded Source

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