Skip to main content
Documentation Status Join the chat at https://gitter.im/epsy/clize https://github.com/epsy/clize/actions/workflows/ci.yml/badge.svg?branch=master https://coveralls.io/repos/epsy/clize/badge.svg?branch=master

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 clize.run.

  • 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__':
    run(hello_world)

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

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

    Greets the world or the given name.

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

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

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

You can find the documentation and tutorials at http://clize.readthedocs.io/

Metadata

Release files for clize 5.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clize 5.0.2
File Size Uploaded
clize-5.0.2.tar.gz 197.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clize 5.0.2
File Interpreter ABI Platform
clize-5.0.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 274.9 kB

Release files / clize-5.0.2.tar.gz

Download URL clize-5.0.2.tar.gz
Size 197.8 kB
Tags Source
SHA-256 checksum
How to use checksums
047f5a4473602718ab1b85672a7e15303387178d5a81c275dc429dfac1ecb510
BLAKE2b-256 checksum
How to use checksums
27d9351db7247739f7cdaa076a1a25163afc7b553af556273729320a64cf0ab4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / clize-5.0.2-py2.py3-none-any.whl

Download URL clize-5.0.2-py2.py3-none-any.whl
Size 77.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c89ce97b5ba89e1f21d13f7a18d9025edf799b136adeb625019c04b79ddee846
BLAKE2b-256 checksum
How to use checksums
2167267b54101fe899f957e70e21b461cb17fa63f0799316e690b4375db202e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page