This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Writing CLI is NOT funny. Especially with all the argument parsing and shit. This is why this module exists.


$ pip install clifactory
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from clifactory import CommandLineInterface, Argument

cli = CommandLineInterface()
users = ["John Doe", "Dick Head"]

@cli.endpoint(Argument('user', help='username to add'))
def do_user_add(args):
    print users

def do_user_list(args):
    print users


As shown in the file.

You can run it like:

$ ./ user add
usage: user add [-h] user user add: error: too few arguments
$ ./ user add "foo bar"
['John Doe', 'Dick Head', 'foo bar']

Simple as that :)


Some more documentation is comming, stay tuned.

Using the module

You have to import the components you need, which for now are:

  • CommandLineInterface
  • Argument
  • ExclusiveGroup

Then instanciate a CommandLineInterface:

cli = CommandLineInterface()

Then decorate your endpoint as follows:

    Argument('argument', help="some help"), # positional arg
    Argument('--user', '-u') # optional argument
def do_something(args):
    print args # args is a argparse.Namespace object

You can add as many arguments as you wish, the parameters have to follow the argparse.add_argument syntax. Note that your function’s name must be prefixed with do_ in order for the parsing to work. It will just break the name of the function into a “tree” where each _-delimited word will be a leaf. So you can add more methods to your ‘user’ endpoint.

Finally to parse something, just call:


This will parse arguments from sys.argv. Alternatively, you may parse an arbitrary string:

cli.parse("some string")

I told you it does not have to be hard!


Copyright (C) 2015  Thomas Maurice <>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <>.
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
clifactory-0.1.1.tar.gz (4.6 kB) Copy SHA256 Checksum SHA256 Source Sep 3, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting