@@ -120,9 +120,10 @@ a list of packages to :func:`setup`'s ``packages`` argument instead of using
120120Using package metadata
121121======================
122122
123- `Setuptools `_ provides `special support `_ for plugins. By
124- providing the ``entry_points `` argument to :func: `setup ` in :file: `setup.py `
125- plugins can register themselves for discovery.
123+ `Setuptools `_ provides :doc: `special support
124+ <setuptools:userguide/entry_point>` for plugins. By providing the
125+ ``entry_points `` argument to :func: `setup ` in :file: `setup.py ` plugins can
126+ register themselves for discovery.
126127
127128For example if you have a package named ``myapp-plugin-a `` and it includes
128129in its :file: `setup.py `:
@@ -150,21 +151,25 @@ Then you can discover and load all of the registered entry points by using
150151 discovered_plugins = entry_points(group = ' myapp.plugins' )
151152
152153
153- In this example, ``discovered_plugins `` would be:
154+ In this example, ``discovered_plugins `` would be a collection of type :class: ` importlib.metadata.EntryPoint ` :
154155
155156.. code-block :: python
156157
157- {
158- ' a' : < module: ' myapp_plugin_a' > ,
159- }
158+ (
159+ EntryPoint(name = ' a' , value = ' myapp_plugin_a' , group = ' myapp.plugins' ),
160+ ...
161+ )
162+
163+ Now the module of your choice can be imported by executing
164+ ``discovered_plugins['a'].load() ``.
160165
161166.. note :: The ``entry_point`` specification in :file:`setup.py` is fairly
162167 flexible and has a lot of options. It's recommended to read over the entire
163- section on `entry points `_.
168+ section on :doc: `entry points <setuptools:userguide/entry_point >` .
169+
170+ .. note :: Since this specification is part of the :doc:`standard library
171+ <python:library/importlib.metadata>`, most packaging tools other than setuptools
172+ provide support for defining entry points.
164173
165174.. _Setuptools : https://setuptools.readthedocs.io
166- .. _special support :
167- .. _entry points :
168- https://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins
169175.. _backport : https://importlib-metadata.readthedocs.io/en/latest/
170-
0 commit comments