Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Human friendly CLI builder

Project description

Human friendly CLI builder.


pip install



from manager import Manager

manager = Manager()

def echo(text, capitalyze=False):
    """print the given <name>"""
    if capitalyze:
        text = text.upper()
    return text

if __name__ == '__main__':

manage --help:

usage: manage [<namespace>.]<command> [<args>]

positional arguments:
  command     the command to run

optional arguments:
  -h, --help  show this help message and exit

available commands:
  echo        print the given <name>

manage echo --help:

$ manage echo --help

usage: manage [-h] [--capitalyze] text

print the given <name>

positional arguments:
  text          no description

optional arguments:
  -h, --help    show this help message and exit
  --capitalyze  no description


Managers can be used together by merging them

from third_party import manager


# Merge within a new namespace:
my_app_manager.merge(manager, namespace='third_party')


Commands can be organized within namespaces

def set(key, value):
    # ...


Currently the framework will assume that arguments with default values are key-value arguments (--arg value) while required arguments are positional ones.

In other words, this definition:

def create(user):

will expect an invocation of the kind:

$ manage create foobar

and user in create() will take the value 'foobar'.

On the other hand, this:

def create(user=''):

will expect an invocation of the kind:

$ manage create --user foobar

The downside is obviously that it’s not currently possible to have a required non-positional argument.

Argument definition can be overridden

@manager.arg('first_arg', help='this is help for first arg')
def my_command(first_arg):
    # ...

Arguments can be prompted

@manager.prompt('password', hidden=True, confirm=True)
def connect(username, password):
    # ...


Environment variables can be sourced from a .env file as key=value pair.

Environment variable can be enforce using Manager.env decorator

def my_command():
    return os.environ['MY_ENV_VAR']

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date (9.7 kB) Copy SHA256 hash SHA256 Source None Jun 15, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page