diff options
author | Saniya Maheshwari <saniya.mah@gmail.com> | 2022-06-10 14:49:35 +0530 |
---|---|---|
committer | Saniya Maheshwari <saniya.mah@gmail.com> | 2022-06-10 14:49:35 +0530 |
commit | fe5ff90caca2069ace055925e78b0624fa5db9fc (patch) | |
tree | 0bd59c9050ef52397079bd4fb2f19c7314527744 /docs/userguide | |
parent | 59982b3be544362818d190f8a896bd53d9b87f09 (diff) | |
download | python-setuptools-git-fe5ff90caca2069ace055925e78b0624fa5db9fc.tar.gz |
Added a note on what `display_eps` would look like
Snippet borrowed from Python Packaging user guide
Diffstat (limited to 'docs/userguide')
-rw-r--r-- | docs/userguide/entry_point.rst | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/docs/userguide/entry_point.rst b/docs/userguide/entry_point.rst index 1b58a7c8..8938ad50 100644 --- a/docs/userguide/entry_point.rst +++ b/docs/userguide/entry_point.rst @@ -179,7 +179,7 @@ body of the function. .. note:: The difference between ``console_scripts`` and ``gui_scripts`` only affects - Windows systems. [#packaging_guide]_ ``console_scripts`` are wrapped in a console + Windows systems. [#use_for_scripts]_ ``console_scripts`` are wrapped in a console executable, so they are attached to a console and can use ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` for input and output. ``gui_scripts`` are wrapped in a GUI executable, so they can be started without a console, but @@ -191,7 +191,7 @@ body of the function. Console and GUI scripts work because behind the scenes, installers like :pypi:`pip` create wrapper scripts around the function(s) being invoked. For example, the ``hello-world`` entry point in the above two examples would create a - command ``hello-world`` launching a script like this: [#packaging_guide]_ + command ``hello-world`` launching a script like this: [#use_for_scripts]_ .. code-block:: python @@ -276,7 +276,15 @@ as follows: .. note:: Each ``importlib.metadata.EntryPoint`` object is an object containing a ``name``, a - ``group``, and a ``value``. + ``group``, and a ``value``. For example, after setting up the plugin package as + described below, ``display_eps`` in the above code will look like this: [#package_metadata]_ + + .. code-block:: python + + ( + EntryPoint(name='excl', value='timmins_plugin_fancy:excl_display', group='timmins.display'), + ..., + ) ``display_eps`` will now be a list of ``EntryPoint`` objects, each referring to ``display()``-like functions defined by one or more installed plugin packages. Then, to import a specific @@ -450,5 +458,8 @@ installed. ``pyproject.toml`` is experimental and might change in the future. See :doc:`/userguide/pyproject_config`. -.. [#packaging_guide] +.. [#use_for_scripts] Reference: https://packaging.python.org/en/latest/specifications/entry-points/#use-for-scripts + +.. [#package_metadata] + Reference: https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/#using-package-metadata |