Skip to main content

A Python module let you quickly convert the functions into a multi-command CLI program

Project description

Note: The 0.1.4 is a rewrote version and it does not provide backward compatibility.

Clime let you convert a module, a dict or an instance into a multi-command CLI program.

It scans the object to find the functions out, so it is low couple with your source.

And, it scan the aliases and metavars of options from docstring, so you are free from writing the settings of options. You can focus on writing the help text of your CLI program.

It is a better choice than the heavy optparse or argparse for simple CLI tasks.

Let me show an example for you.

See the full documentaion on .

CLI-ize ME!

Here we have a simple script with docstring here:

# filename:

def repeat(string, time=2):
    '''repeat string n times

        -n N, --time N  repeat N times.

    print string * time

After add this line,


… you now have a CLI program!

$ python twice

$ python -n3 thrice

And it gerneate the usage from your function:

$ python --help
usage: [--time N | -n N] STRING
   or: repeat [--time N | -n N] STRING

If you wrote a docstring, it will also show up in help text.

$ python repeat --help
usage: [--time N | -n N] STRING
   or: repeat [--time N | -n N] STRING

repeat string n times

    -n N, --time N  repeat N times.

You can find more examples in the clime/examples.

See Command.scan for more details about argument parsing.


Clime is hosted on two different platforms, PyPI and GitHub.

  1. Install from PyPI

    Install Clime from PyPI for a stable version

    $ sudo pip install clime

    If you don’t have pip, execute

    $ sudo apt-get install python-pip

    to install pip on Debian-base Linux distribution.

  2. Get Clime from GitHub

    If you want to follow the lastest version of Clime, use

    $ git clone git://

    to clone a Clime repository. Or download manually from GitHub.


Here is the basic usage of Clime.

You have two different ways to use Clime.

  1. Insert A Line into Your Source

    Just add this line into your source


    It is recommend to put the codes into the if __name__ == '__main__': block.

  2. Use Clime as A Command

    clime is also an executable module. Use it to convert a module or a Python file temporarily.

    $ python -m clime TARGET

See clime.Program for more usages.

More Details

These are the basics of Clime usage. If you want to know more, details are here: Take a Deeper Look at Clime.

Project details

Download files

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

Files for clime, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size clime-0.1.4.tar.gz (13.1 kB) File type Source Python version None Upload date Hashes View hashes

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 DigiCert DigiCert EV certificate StatusPage StatusPage Status page