{ "info": { "author": "Kevin Wurster, Sean Gillies", "author_email": "wursterk@gmail.com, sean.gillies@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Utilities" ], "description": "=============\nclick-plugins\n=============\n\n.. image:: https://travis-ci.org/click-contrib/click-plugins.svg?branch=master\n :target: https://travis-ci.org/click-contrib/click-plugins?branch=master\n\n.. image:: https://coveralls.io/repos/click-contrib/click-plugins/badge.svg?branch=master&service=github\n :target: https://coveralls.io/github/click-contrib/click-plugins?branch=master\n\nAn extension module for `click `_ to register\nexternal CLI commands via setuptools entry-points.\n\n\nWhy?\n----\n\nLets say you develop a commandline interface and someone requests a new feature\nthat is absolutely related to your project but would have negative consequences\nlike additional dependencies, major refactoring, or maybe its just too domain\nspecific to be supported directly. Rather than developing a separate standalone\nutility you could offer up a `setuptools entry point `_\nthat allows others to use your commandline utility as a home for their related\nsub-commands. You get to choose where these sub-commands or sub-groups CAN be\nregistered but the plugin developer gets to choose they ARE registered. You\ncould have all plugins register alongside the core commands, in a special\nsub-group, across multiple sub-groups, or some combination.\n\n\nEnabling Plugins\n----------------\n\nFor a more detailed example see the `examples `_ section.\n\nThe only requirement is decorating ``click.group()`` with ``click_plugins.with_plugins()``\nwhich handles attaching external commands and groups. In this case the core CLI developer\nregisters CLI plugins from ``core_package.cli_plugins``.\n\n.. code-block:: python\n\n from pkg_resources import iter_entry_points\n\n import click\n from click_plugins import with_plugins\n\n\n @with_plugins(iter_entry_points('core_package.cli_plugins'))\n @click.group()\n def cli():\n \"\"\"Commandline interface for yourpackage.\"\"\"\n\n @cli.command()\n def subcommand():\n \"\"\"Subcommand that does something.\"\"\"\n\n\nDeveloping Plugins\n------------------\n\nPlugin developers need to register their sub-commands or sub-groups to an\nentry-point in their ``setup.py`` that is loaded by the core package.\n\n.. code-block:: python\n\n from setuptools import setup\n\n setup(\n name='yourscript',\n version='0.1',\n py_modules=['yourscript'],\n install_requires=[\n 'click',\n ],\n entry_points='''\n [core_package.cli_plugins]\n cool_subcommand=yourscript.cli:cool_subcommand\n another_subcommand=yourscript.cli:another_subcommand\n ''',\n )\n\n\nBroken and Incompatible Plugins\n-------------------------------\n\nAny sub-command or sub-group that cannot be loaded is caught and converted to\na ``click_plugins.core.BrokenCommand()`` rather than just crashing the entire\nCLI. The short-help is converted to a warning message like:\n\n.. code-block:: console\n\n Warning: could not load plugin. See `` --help``.\n\nand if the sub-command or group is executed the entire traceback is printed.\n\n\nBest Practices and Extra Credit\n-------------------------------\n\nOpening a CLI to plugins encourages other developers to independently extend\nfunctionality independently but there is no guarantee these new features will\nbe \"on brand\". Plugin developers are almost certainly already using features\nin the core package the CLI belongs to so defining commonly used arguments and\noptions in one place lets plugin developers reuse these flags to produce a more\ncohesive CLI. If the CLI is simple maybe just define them at the top of\n``yourpackage/cli.py`` or for more complex packages something like\n``yourpackage/cli/options.py``. These common options need to be easy to find\nand be well documented so that plugin developers know what variable to give to\ntheir sub-command's function and what object they can expect to receive. Don't\nforget to document non-obvious callbacks.\n\nKeep in mind that plugin developers also have access to the parent group's\n``ctx.obj``, which is very useful for passing things like verbosity levels or\nconfig values around to sub-commands.\n\nHere's some code that sub-commands could re-use:\n\n.. code-block:: python\n\n from multiprocessing import cpu_count\n\n import click\n\n jobs_opt = click.option(\n '-j', '--jobs', metavar='CORES', type=click.IntRange(min=1, max=cpu_count()), default=1,\n show_default=True, help=\"Process data across N cores.\"\n )\n\nPlugin developers can access this with:\n\n.. code-block:: python\n\n import click\n import parent_cli_package.cli.options\n\n\n @click.command()\n @parent_cli_package.cli.options.jobs_opt\n def subcommand(jobs):\n \"\"\"I do something domain specific.\"\"\"\n\n\nInstallation\n------------\n\nWith ``pip``:\n\n.. code-block:: console\n\n $ pip install click-plugins\n\nFrom source:\n\n.. code-block:: console\n\n $ git clone https://github.com/click-contrib/click-plugins.git\n $ cd click-plugins\n $ python setup.py install\n\n\nDeveloping\n----------\n\n.. code-block:: console\n\n $ git clone https://github.com/click-contrib/click-plugins.git\n $ cd click-plugins\n $ pip install -e .\\[dev\\]\n $ pytest tests --cov click_plugins --cov-report term-missing\n\n\nChangelog\n---------\n\nSee ``CHANGES.txt``\n\n\nAuthors\n-------\n\nSee ``AUTHORS.txt``\n\n\nLicense\n-------\n\nSee ``LICENSE.txt``\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/click-contrib/click-plugins", "keywords": "click plugin setuptools entry-point", "license": "New BSD", "maintainer": "", "maintainer_email": "", "name": "click-plugins", "package_url": "https://pypi.org/project/click-plugins/", "platform": "", "project_url": "https://pypi.org/project/click-plugins/", "project_urls": { "Homepage": "https://github.com/click-contrib/click-plugins" }, "release_url": "https://pypi.org/project/click-plugins/1.1.1/", "requires_dist": [ "click (>=4.0)", "pytest (>=3.6) ; extra == 'dev'", "pytest-cov ; extra == 'dev'", "wheel ; extra == 'dev'", "coveralls ; extra == 'dev'" ], "requires_python": "", "summary": "An extension module for click to enable registering CLI commands via setuptools entry-points.", "version": "1.1.1" }, "last_serial": 5094232, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "8f509404545c82185b609452f9535bef", "sha256": "a6260de2625d70ee284b599a8f3096f30adb9b824b647c1234a901a920ae02bc" }, "downloads": -1, "filename": "click-plugins-1.0.tar.gz", "has_sig": false, "md5_digest": "8f509404545c82185b609452f9535bef", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7766, "upload_time": "2015-07-21T02:58:24", "url": "https://files.pythonhosted.org/packages/41/a3/713ebb70fceb873ff26420d3b9f3bc3b3ef5bd984e312a389fbc86f5d632/click-plugins-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "621adda167bc06dc19d1516e0880f4ea", "sha256": "94e6e289e9f10dfe85a35f54891bd071b1640d5b08777995457f38c282e59f67" }, "downloads": -1, "filename": "click-plugins-1.0.1.tar.gz", "has_sig": false, "md5_digest": "621adda167bc06dc19d1516e0880f4ea", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7688, "upload_time": "2015-08-20T14:25:52", "url": "https://files.pythonhosted.org/packages/ba/ef/0aceb19f37878751c650979bbcd3fa45cbbb8ce15d3e98252c710a2e2276/click-plugins-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "075da7381870185ce5dca240f59c2b26", "sha256": "e30d234a5d20ce36f4cad4288a72d00d4b1d0fa99684dfb2b81fc061ce70c89a" }, "downloads": -1, "filename": "click_plugins-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "075da7381870185ce5dca240f59c2b26", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9403, "upload_time": "2015-09-23T15:30:05", "url": "https://files.pythonhosted.org/packages/cb/cc/22f0fb5fa1cb8399b174b83579df3f4e03bf716b565e3a6eddde1e5a4ae4/click_plugins-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3e45378f26dc08e0a4aaaf36b052284d", "sha256": "3e33f24dafbc8f52dd2a557f5fb1452acc7ab67ff354220a832a393bdedb46a8" }, "downloads": -1, "filename": "click-plugins-1.0.2.tar.gz", "has_sig": false, "md5_digest": "3e45378f26dc08e0a4aaaf36b052284d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7915, "upload_time": "2015-09-23T15:30:23", "url": "https://files.pythonhosted.org/packages/36/dd/c16c0fe86407fa799259b49eda413fa8dbaa556e0ca280b3fd7732f24cce/click-plugins-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "ddc85a5c51399713f801ae6b63fcac5b", "sha256": "7acc5e7eedd2dfd719714e8d53ae99030b5357aed661d0b06dacd6c2d583d7c5" }, "downloads": -1, "filename": "click-plugins-1.0.3.tar.gz", "has_sig": false, "md5_digest": "ddc85a5c51399713f801ae6b63fcac5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7950, "upload_time": "2016-01-05T18:47:11", "url": "https://files.pythonhosted.org/packages/77/05/da5c9e19457f20cadfe22c397cd3852577066066f63e40f2baa0831b1693/click-plugins-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "df99f9d23dc509b3f45b4eb3ce2399d7", "sha256": "b1ee1ccc9421c73007fe290680d97984eb6eaf5f4512b7620c6aa46031d6cb6b" }, "downloads": -1, "filename": "click_plugins-1.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "df99f9d23dc509b3f45b4eb3ce2399d7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6199, "upload_time": "2018-09-16T00:26:15", "url": "https://files.pythonhosted.org/packages/95/dd/fef84cf1678418f241ef542c0288bdf215bdd3e35f1fe03dc5223a2e80ba/click_plugins-1.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3db73ba58271e3d9644be9b9c03a9d8d", "sha256": "dfed74b5063546a137de99baaaf742b4de4337ad2b3e1df5ec7c8a256adc0847" }, "downloads": -1, "filename": "click-plugins-1.0.4.tar.gz", "has_sig": false, "md5_digest": "3db73ba58271e3d9644be9b9c03a9d8d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7984, "upload_time": "2018-09-16T00:26:17", "url": "https://files.pythonhosted.org/packages/09/30/2e963988d037b0f400753e958da88c1eecf3739aba6e532d863f4e94d137/click-plugins-1.0.4.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "5658c8fb636578f370af71a4bcb221c5", "sha256": "c313f8af17036d2667d0165bf9030f672a6d5f4b9c084090ada5584b9bd7de13" }, "downloads": -1, "filename": "click_plugins-1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5658c8fb636578f370af71a4bcb221c5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7465, "upload_time": "2019-04-04T04:17:13", "url": "https://files.pythonhosted.org/packages/2e/28/32c4a7c032288dfdb646722ffaaaa79c1e27485da5aa3e189054f852bff3/click_plugins-1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6b537d20b20ffe649ef2d922d0c618b2", "sha256": "b7d23e0e06e7e51090372af5d01be17164bc221bc1ed6eca7145ded16c96aa0f" }, "downloads": -1, "filename": "click-plugins-1.1.tar.gz", "has_sig": false, "md5_digest": "6b537d20b20ffe649ef2d922d0c618b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8129, "upload_time": "2019-04-04T04:17:15", "url": "https://files.pythonhosted.org/packages/51/fb/5fef968dfad2d97575cf5d9ed5f2b659029e461837315dff5a569bdea468/click-plugins-1.1.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "943968f6aa1a14862f164c2080cb2fda", "sha256": "5d262006d3222f5057fd81e1623d4443e41dcda5dc815c06b442aa3c02889fc8" }, "downloads": -1, "filename": "click_plugins-1.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "943968f6aa1a14862f164c2080cb2fda", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7497, "upload_time": "2019-04-04T04:27:03", "url": "https://files.pythonhosted.org/packages/e9/da/824b92d9942f4e472702488857914bdd50f73021efea15b4cad9aca8ecef/click_plugins-1.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "969268b5b005b2b56115c66c55013252", "sha256": "46ab999744a9d831159c3411bb0c79346d94a444df9a3a3742e9ed63645f264b" }, "downloads": -1, "filename": "click-plugins-1.1.1.tar.gz", "has_sig": false, "md5_digest": "969268b5b005b2b56115c66c55013252", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8164, "upload_time": "2019-04-04T04:27:04", "url": "https://files.pythonhosted.org/packages/5f/1d/45434f64ed749540af821fd7e42b8e4d23ac04b1eda7c26613288d6cd8a8/click-plugins-1.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "943968f6aa1a14862f164c2080cb2fda", "sha256": "5d262006d3222f5057fd81e1623d4443e41dcda5dc815c06b442aa3c02889fc8" }, "downloads": -1, "filename": "click_plugins-1.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "943968f6aa1a14862f164c2080cb2fda", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7497, "upload_time": "2019-04-04T04:27:03", "url": "https://files.pythonhosted.org/packages/e9/da/824b92d9942f4e472702488857914bdd50f73021efea15b4cad9aca8ecef/click_plugins-1.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "969268b5b005b2b56115c66c55013252", "sha256": "46ab999744a9d831159c3411bb0c79346d94a444df9a3a3742e9ed63645f264b" }, "downloads": -1, "filename": "click-plugins-1.1.1.tar.gz", "has_sig": false, "md5_digest": "969268b5b005b2b56115c66c55013252", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8164, "upload_time": "2019-04-04T04:27:04", "url": "https://files.pythonhosted.org/packages/5f/1d/45434f64ed749540af821fd7e42b8e4d23ac04b1eda7c26613288d6cd8a8/click-plugins-1.1.1.tar.gz" } ] }