summaryrefslogtreecommitdiff
path: root/docs/userguide/entry_point.rst
diff options
context:
space:
mode:
authorThomas Grainger <tagrain@gmail.com>2021-07-20 10:34:10 +0100
committerThomas Grainger <tagrain@gmail.com>2021-07-20 10:35:04 +0100
commit45f900b7bf4aa300846727024672c5d49b1b14cf (patch)
treed21759f07a82bf15987fe8d8b22b5e5db0fb9e4c /docs/userguide/entry_point.rst
parent015c7c08cc801fe8abe6be5fbfa7a538f482fdec (diff)
downloadpython-setuptools-git-45f900b7bf4aa300846727024672c5d49b1b14cf.tar.gz
blacken docs
Diffstat (limited to 'docs/userguide/entry_point.rst')
-rw-r--r--docs/userguide/entry_point.rst12
1 files changed, 7 insertions, 5 deletions
diff --git a/docs/userguide/entry_point.rst b/docs/userguide/entry_point.rst
index 63d30a48..3244ce39 100644
--- a/docs/userguide/entry_point.rst
+++ b/docs/userguide/entry_point.rst
@@ -36,7 +36,8 @@ and ``__main__.py`` providing a hook:
.. code-block:: python
from . import hello_world
- if __name__ == '__main__':
+
+ if __name__ == "__main__":
hello_world()
After installing the package, the function may be invoked through the
@@ -102,10 +103,10 @@ module (part of stdlib since Python 3.8) or its backport,
For example, to find the console script entry points from the example above:
-.. code-block:: python
+.. code-block:: pycon
>>> from importlib import metadata
- >>> eps = metadata.entry_points()['console_scripts']
+ >>> eps = metadata.entry_points()["console_scripts"]
``eps`` is now a list of ``EntryPoint`` objects, one of which corresponds
to the ``hello-world = timmins:hello_world`` defined above. Each ``EntryPoint``
@@ -121,13 +122,14 @@ method to import and load that entry point (module or object).
Then, a different project wishing to load 'my.plugins' plugins could run
the following routine to load (and invoke) such plugins:
-.. code-block:: python
+.. code-block:: pycon
>>> from importlib import metadata
- >>> eps = metadata.entry_points()['my.plugins']
+ >>> eps = metadata.entry_points()["my.plugins"]
>>> for ep in eps:
... plugin = ep.load()
... plugin()
+ ...
The project soliciting the entry points needs not to have any dependency
or prior knowledge about the libraries implementing the entry points, and