Skip to main content

Turn functions into command-line interfaces

Project description

Documentation Status Join the chat at

Clize is an argument parser for Python. You can use Clize as an alternative to argparse if you want an even easier way to create command-line interfaces.

With Clize, you can:

  • Create command-line interfaces by creating functions and passing them to

  • Enjoy a CLI automatically created from your functions’ parameters.

  • Bring your users familiar --help messages generated from your docstrings.

  • Reuse functionality across multiple commands using decorators.

  • Extend Clize with new parameter behavior.

Here’s an example:

from clize import run

def hello_world(name=None, *, no_capitalize=False):
    """Greets the world or the given name.

    :param name: If specified, only greet this person.
    :param no_capitalize: Don't capitalize the given name.
    if name:
        if not no_capitalize:
            name = name.title()
        return 'Hello {0}!'.format(name)
    return 'Hello world!'

if __name__ == '__main__':

The python code above can now be used on the command-line as follows:

$ pip install clize
$ python3 --help
    Usage: [OPTIONS] name

    Greets the world or the given name.

    Positional arguments:
      name   If specified, only greet this person.

      --no-capitalize   Don't capitalize the given name.

    Other actions:
      -h, --help   Show the help
$ python3
Hello world!
$ python3 john
Hello John!
$ python3 dave --no-capitalize
Hello dave!

You can find the documentation and tutorials at

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

clize-5.0.2.tar.gz (197.8 kB view hashes)

Uploaded Source

Built Distribution

clize-5.0.2-py2.py3-none-any.whl (77.1 kB view hashes)

Uploaded Python 2 Python 3

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