Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A python framwork to write large CLIs using dependency injection

Project Description


.. image::

.. image::

.. image::
:alt: Documentation Status

.. image::
:alt: Updates

A python framework to write large CLIs. The concept is to automagically derive CLI commands and args based on the object graph of a callable class that implements a CLI command (command name is derived from the class name). It uses argparse_ to create the CLI parser and pinject_ as the Dependency_Injection_ engine. You implement a class - e.g.: ``DoSomething``- and that generates the name of a subcommand - e.g: ``do-something``. Then, based on the dependencies of class ``DoSomething``, we will derive the arguments, e.g.: if ``DoSomething`` depends on ``Dependency``, which in turn declares ``__args__ = [bigcli.arg('--option', required=False, help='help')]`` (add_argument_ method from argparse_), then command ``do-something`` will have a '--option' argument.

In theory, the auto-generation of arguments should enables and encourage the reuse of internal components for rapid development of consistent and testable rich CLIs, especially those that operate platforms.

* Free software: MIT license
* Documentation:

Minimal example:

.. code-block:: python

#!/usr/bin/env python
import bigcli

class Dependency(object):
__args__ = [
bigcli.arg('--option') # short for ``lambda p: p.add_argument('--option')``

def __init__(self, args):
self.option = args.option

class Command(object):
__parent__ = 'sub-command'
__depends_on__ = [Dependency]

def __init__(self, dependency):
self.dependency = dependency

def __call__(self):
print "dependency option: {}".format(self.dependency.option)

if __name__ == "__main__":

# $ ./ sub-command command --option value
# > dependency option: value

Features (see tests for example)

* Auto generates parsers and commands using the ``__depends_on__`` and ``__args__`` attributes.
* Supports adding single subcommand using the ``__parent__ = 'subcommand'`` attribute.

Known Issues:

* Only supports python 2.7 because pinject_ only supports python 2.7.
* Class names should have more than a single letter (pinject know issue, not documented anywhere AFAIK).


This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
.. _Dependency_Injection:
.. _Cookiecutter:
.. _`audreyr/cookiecutter-pypackage`:
.. _add_argument:
.. _argparse:
.. _pinject:


0.1.0 (2017-07-25)

* First release on PyPI.

Release History

This version
History Node


History Node


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
(6.3 kB) Copy SHA256 Hash SHA256
Wheel py2.py3 Oct 21, 2017
(15.4 kB) Copy SHA256 Hash SHA256
Source None Oct 21, 2017

Supported By

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 Google Google Cloud Servers DreamHost DreamHost Log Hosting