Skip to content

Commit

Permalink
Add PEP 621 tab for entry points docs (#1115)
Browse files Browse the repository at this point in the history
* Add PEP 621 tab for entry points

* Maybe fix ref

* maybe it can’t handle links in tab headers?

* remove tabs again

* Better explanation

* fix link

Co-authored-by: Brian Rutledge <brian@bhrutledge.com>
  • Loading branch information
flying-sheep and bhrutledge authored Dec 4, 2022
1 parent 91b599b commit 90027de
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions source/guides/creating-and-discovering-plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,20 @@ a list of packages to :func:`setup`'s ``packages`` argument instead of using
Using package metadata
======================

:doc:`Setuptools <setuptools:index>` provides :doc:`special support
<setuptools:userguide/entry_point>` for plugins. By providing the
``entry_points`` argument to :func:`setup` in :file:`setup.py` plugins can
register themselves for discovery.
Packages can have metadata for plugins described in the :ref:`entry-points`.
By specifying them, a package announces that it contains a specific kind of plugin.
Another package supporting this kind of plugin can use the metadata to discover that plugin.

For example if you have a package named ``myapp-plugin-a`` and it includes
in its :file:`setup.py`:
the following in its ``pyproject.toml``:

.. code-block:: python
.. code-block:: toml
setup(
...
entry_points={'myapp.plugins': 'a = myapp_plugin_a'},
...
)
[project.entry-points.'myapp.plugins']
a = 'myapp_plugin_a'
Then you can discover and load all of the registered entry points by using
:func:`importlib.metadata.entry_points` (or the `backport`_
:func:`importlib.metadata.entry_points` (or the backport_
``importlib_metadata >= 3.6`` for Python 3.6-3.9):

.. code-block:: python
Expand Down

0 comments on commit 90027de

Please sign in to comment.