@@ -72,15 +72,43 @@ Entry points are represented by ``EntryPoint`` instances;
7272each ``EntryPoint `` has a ``.name ``, ``.group ``, and ``.value `` attributes and
7373a ``.load() `` method to resolve the value. There are also ``.module ``,
7474``.attr ``, and ``.extras `` attributes for getting the components of the
75- ``.value `` attribute::
75+ ``.value `` attribute.
76+
77+ Query all entry points::
7678
7779 >>> eps = entry_points()
80+
81+ The ``entry_points() `` function returns an ``EntryPoints `` object,
82+ a sequence of all ``EntryPoint `` objects with ``names `` and ``groups ``
83+ attributes for convenience.
84+
7885 >>> sorted (eps.groups)
7986 ['console_scripts', 'distutils.commands', 'distutils.setup_keywords', 'egg_info.writers', 'setuptools.installation']
87+
88+ ``EntryPoints `` has a ``select `` method to select entry points
89+ matching specific properties. Select entry points in the
90+ ``console_scripts `` group::
91+
8092 >>> scripts = eps.select(group='console_scripts')
93+
94+ Equivalently, since ``entry_points `` passes keyword arguments
95+ through to select::
96+
97+ >>> scripts = entry_points(group='console_scripts')
98+
99+ Pick out a specific script named "wheel" (found in the wheel project)::
100+
81101 >>> 'wheel' in scripts.names
82102 True
83103 >>> wheel = scripts['wheel']
104+
105+ Equivalently, query for that entry point during selection::
106+
107+ >>> (wheel,) = entry_points(group='console_scripts', name='wheel')
108+ >>> (wheel,) = entry_points().select(group='console_scripts', name='wheel')
109+
110+ Inspect the resolved entry point::
111+
84112 >>> wheel
85113 EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts')
86114 >>> wheel.module
@@ -99,6 +127,17 @@ group. Read `the setuptools docs
99127<https://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins> `_
100128for more information on entry points, their definition, and usage.
101129
130+ *Compatibility Note *
131+
132+ The "selectable" entry points were introduced in ``importlib_metadata ``
133+ 3.6 and Python 3.10. Prior to those changes, ``entry_points `` accepted
134+ no parameters and always returned a dictionary of entry points, keyed
135+ by group. For compatibility, if no parameters are passed to entry_points,
136+ a ``SelectableGroups `` object is returned, implementing that dict
137+ interface. In the future, calling ``entry_points `` with no parameters
138+ will return an ``EntryPoints `` object. Users should rely on the selection
139+ interface to retrieve entry points by group.
140+
102141
103142.. _metadata :
104143
0 commit comments