diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2021-03-13 16:31:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-13 16:31:45 (GMT) |
commit | f917efccf8d5aa2b8315d2a832a520339e668187 (patch) | |
tree | 25319b76b7c107939278df8ebaaeed52619462bb /Doc | |
parent | 2256a2876b5214a5a7492bf78bd86cf8beb690bf (diff) | |
download | cpython-f917efccf8d5aa2b8315d2a832a520339e668187.zip cpython-f917efccf8d5aa2b8315d2a832a520339e668187.tar.gz cpython-f917efccf8d5aa2b8315d2a832a520339e668187.tar.bz2 |
bpo-43428: Sync with importlib_metadata 3.7. (GH-24782)
* bpo-43428: Sync with importlib_metadata 3.7.2 (67234b6)
* Add blurb
* Reformat blurb to create separate paragraphs for each change included.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/importlib.metadata.rst | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/Doc/library/importlib.metadata.rst b/Doc/library/importlib.metadata.rst index 7f154ea..ffce1ba 100644 --- a/Doc/library/importlib.metadata.rst +++ b/Doc/library/importlib.metadata.rst @@ -74,18 +74,20 @@ This package provides the following functionality via its public API. Entry points ------------ -The ``entry_points()`` function returns a dictionary of all entry points, -keyed by group. Entry points are represented by ``EntryPoint`` instances; +The ``entry_points()`` function returns a collection of entry points. +Entry points are represented by ``EntryPoint`` instances; each ``EntryPoint`` has a ``.name``, ``.group``, and ``.value`` attributes and a ``.load()`` method to resolve the value. There are also ``.module``, ``.attr``, and ``.extras`` attributes for getting the components of the ``.value`` attribute:: >>> eps = entry_points() # doctest: +SKIP - >>> list(eps) # doctest: +SKIP + >>> sorted(eps.groups) # doctest: +SKIP ['console_scripts', 'distutils.commands', 'distutils.setup_keywords', 'egg_info.writers', 'setuptools.installation'] - >>> scripts = eps['console_scripts'] # doctest: +SKIP - >>> wheel = [ep for ep in scripts if ep.name == 'wheel'][0] # doctest: +SKIP + >>> scripts = eps.select(group='console_scripts') # doctest: +SKIP + >>> 'wheel' in scripts.names # doctest: +SKIP + True + >>> wheel = scripts['wheel'] # doctest: +SKIP >>> wheel # doctest: +SKIP EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts') >>> wheel.module # doctest: +SKIP @@ -187,6 +189,17 @@ function:: ["pytest (>=3.0.0) ; extra == 'test'", "pytest-cov ; extra == 'test'"] +Package distributions +--------------------- + +A convience method to resolve the distribution or +distributions (in the case of a namespace package) for top-level +Python packages or modules:: + + >>> packages_distributions() + {'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': ['jaraco.classes', 'jaraco.functools'], ...} + + Distributions ============= |