An extension module for [click] to register
external CLI commands via setuptools entry-points.
Lets say you develop a commandline interface and someone requests a new
that is absolutely related to your project but would have negative
like additional dependencies, major refactoring, or maybe its just too
specific to be supported directly. Rather than developing a separate
utility you could offer up a [setuptools entry point]
that allows others to use your commandline utility as a home for their
sub-commands. You get to choose where these sub-commands or sub-groups CAN
registered but the plugin developer gets to choose they ARE registered.
could have all plugins register alongside the core commands, in a special
sub-group, across multiple sub-groups, or some combination.
For a more detailed example see the [examples] section.
The only requirement is decorating ``click.group() with
which handles attaching external commands and groups. In this case the
core CLI developer
registers CLI plugins from ``core_package.cli_plugins``.
.. code-block:: python
from pkg_resources import iter_entry_points
from click_plugins import with_plugins
"""Commandline interface for yourpackage."""
"""Subcommand that does something."""
Plugin developers need to register their sub-commands or sub-groups to an
entry-point in their ``setup.py`` that is loaded by the core package.
.. code-block:: python
from setuptools import setup
Broken and Incompatible Plugins
Any sub-command or sub-group that cannot be loaded is caught and converted
a ``click_plugins.core.BrokenCommand()`` rather than just crashing the
CLI. The short-help is converted to a warning message like:
.. code-block:: console
Warning: could not load plugin. See `` --help``.
and if the sub-command or group is executed the entire traceback is
Best Practices and Extra Credit
Opening a CLI to plugins encourages other developers to independently
Configuration Switches (platform-specific settings discarded)
PY38 ON Build using Python 3.8
PY39 OFF Build using Python 3.9
Package Dependencies by Type
Distribution File Information
5d262006d3222f5057fd81e1623d4443e41dcda5dc815c06b442aa3c02889fc8 7497 click_plugins-1.1.1-py2.py3-none-any.whl
Ports that require python-click-plugins:py38