clize


Nameclize JSON
Version 5.0.2 PyPI version JSON
download
home_pagehttps://github.com/epsy/clize
SummaryTurn functions into command-line interfaces
upload_time2023-07-09 22:54:51
maintainer
docs_urlNone
authorYann Kaiser
requires_python>=3.6
licenseMIT
keywords cli options arguments getopts getopt argparse introspection flags decorator subcommands
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            *****
Clize
*****

.. image:: https://readthedocs.org/projects/clize/badge/?version=stable
   :target: http://clize.readthedocs.io/en/stable/?badge=stable
   :alt: Documentation Status
.. image:: https://badges.gitter.im/Join%20Chat.svg
   :alt: Join the chat at https://gitter.im/epsy/clize
   :target: https://gitter.im/epsy/clize?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
.. image:: https://github.com/epsy/clize/actions/workflows/ci.yml/badge.svg?branch=master
   :target: https://github.com/epsy/clize/actions/workflows/ci.yml
.. image:: https://coveralls.io/repos/epsy/clize/badge.svg?branch=master
   :target: https://coveralls.io/r/epsy/clize?branch=master

Clize is an argument parser for `Python <https://www.python.org/>`_.  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:**

.. code-block:: python

    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:

.. code-block:: console

    $ 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/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/epsy/clize",
    "name": "clize",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "CLI,options,arguments,getopts,getopt,argparse,introspection,flags,decorator,subcommands",
    "author": "Yann Kaiser",
    "author_email": "kaiser.yann@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/27/d9/351db7247739f7cdaa076a1a25163afc7b553af556273729320a64cf0ab4/clize-5.0.2.tar.gz",
    "platform": null,
    "description": "*****\nClize\n*****\n\n.. image:: https://readthedocs.org/projects/clize/badge/?version=stable\n   :target: http://clize.readthedocs.io/en/stable/?badge=stable\n   :alt: Documentation Status\n.. image:: https://badges.gitter.im/Join%20Chat.svg\n   :alt: Join the chat at https://gitter.im/epsy/clize\n   :target: https://gitter.im/epsy/clize?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge\n.. image:: https://github.com/epsy/clize/actions/workflows/ci.yml/badge.svg?branch=master\n   :target: https://github.com/epsy/clize/actions/workflows/ci.yml\n.. image:: https://coveralls.io/repos/epsy/clize/badge.svg?branch=master\n   :target: https://coveralls.io/r/epsy/clize?branch=master\n\nClize is an argument parser for `Python <https://www.python.org/>`_.  You can\nuse Clize as an alternative to ``argparse`` if you want an even easier way to\ncreate command-line interfaces.\n\n**With Clize, you can:**\n\n* Create command-line interfaces by creating functions and passing them to\n  `clize.run`.\n* Enjoy a CLI automatically created from your functions' parameters.\n* Bring your users familiar ``--help`` messages generated from your docstrings.\n* Reuse functionality across multiple commands using decorators.\n* Extend Clize with new parameter behavior.\n\n**Here's an example:**\n\n.. code-block:: python\n\n    from clize import run\n\n    def hello_world(name=None, *, no_capitalize=False):\n        \"\"\"Greets the world or the given name.\n\n        :param name: If specified, only greet this person.\n        :param no_capitalize: Don't capitalize the given name.\n        \"\"\"\n        if name:\n            if not no_capitalize:\n                name = name.title()\n            return 'Hello {0}!'.format(name)\n        return 'Hello world!'\n\n    if __name__ == '__main__':\n        run(hello_world)\n\nThe python code above can now be used on the command-line as follows:\n\n.. code-block:: console\n\n    $ pip install clize\n    $ python3 hello.py --help\n        Usage: hello.py [OPTIONS] name\n\n        Greets the world or the given name.\n\n        Positional arguments:\n          name   If specified, only greet this person.\n\n        Options:\n          --no-capitalize   Don't capitalize the given name.\n\n        Other actions:\n          -h, --help   Show the help\n    $ python3 hello.py\n    Hello world!\n    $ python3 hello.py john\n    Hello John!\n    $ python3 hello.py dave --no-capitalize\n    Hello dave!\n\nYou can find the documentation and tutorials at http://clize.readthedocs.io/\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Turn functions into command-line interfaces",
    "version": "5.0.2",
    "project_urls": {
        "Homepage": "https://github.com/epsy/clize"
    },
    "split_keywords": [
        "cli",
        "options",
        "arguments",
        "getopts",
        "getopt",
        "argparse",
        "introspection",
        "flags",
        "decorator",
        "subcommands"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2167267b54101fe899f957e70e21b461cb17fa63f0799316e690b4375db202e2",
                "md5": "46a6d39c5e3f206921fa976594c0bc9e",
                "sha256": "c89ce97b5ba89e1f21d13f7a18d9025edf799b136adeb625019c04b79ddee846"
            },
            "downloads": -1,
            "filename": "clize-5.0.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "46a6d39c5e3f206921fa976594c0bc9e",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 77052,
            "upload_time": "2023-07-09T22:54:49",
            "upload_time_iso_8601": "2023-07-09T22:54:49.199324Z",
            "url": "https://files.pythonhosted.org/packages/21/67/267b54101fe899f957e70e21b461cb17fa63f0799316e690b4375db202e2/clize-5.0.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "27d9351db7247739f7cdaa076a1a25163afc7b553af556273729320a64cf0ab4",
                "md5": "bd3c5b678827b41458d972bb7181b8fa",
                "sha256": "047f5a4473602718ab1b85672a7e15303387178d5a81c275dc429dfac1ecb510"
            },
            "downloads": -1,
            "filename": "clize-5.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "bd3c5b678827b41458d972bb7181b8fa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 197813,
            "upload_time": "2023-07-09T22:54:51",
            "upload_time_iso_8601": "2023-07-09T22:54:51.098277Z",
            "url": "https://files.pythonhosted.org/packages/27/d9/351db7247739f7cdaa076a1a25163afc7b553af556273729320a64cf0ab4/clize-5.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-09 22:54:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "epsy",
    "github_project": "clize",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "clize"
}
        
Elapsed time: 2.08361s