Skip to content

Commit f426c0b

Browse files
Merge pull request #12469 from webknjaz/maintenance/non-setuptools-entry-points
📝 Make "setuptools entrypoint" term generic
2 parents 20dd1d6 + cb17947 commit f426c0b

File tree

12 files changed

+36
-21
lines changed

12 files changed

+36
-21
lines changed

changelog/12469.doc.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
The external plugin mentions in the documentation now avoid mentioning
2+
:std:doc:`setuptools entry-points <setuptools:index>` as the concept is
3+
much more generic nowadays. Instead, the terminology of "external",
4+
"installed", or "third-party" plugins (or packages) replaces that.
5+
6+
-- by :user:`webknjaz`

changelog/12469.improvement.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The console output now uses the "third-party plugins" terminology,
2+
replacing the previously established but confusing and outdated
3+
reference to :std:doc:`setuptools <setuptools:index>`
4+
-- by :user:`webknjaz`.

doc/en/example/simple.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ the command line arguments before they get processed:
212212

213213
.. code-block:: python
214214
215-
# setuptools plugin
215+
# installable external plugin
216216
import sys
217217
218218
@@ -1073,8 +1073,8 @@ Instead of freezing the pytest runner as a separate executable, you can make
10731073
your frozen program work as the pytest runner by some clever
10741074
argument handling during program startup. This allows you to
10751075
have a single executable, which is usually more convenient.
1076-
Please note that the mechanism for plugin discovery used by pytest
1077-
(setuptools entry points) doesn't work with frozen executables so pytest
1076+
Please note that the mechanism for plugin discovery used by pytest (:ref:`entry
1077+
points <pip-installable plugins>`) doesn't work with frozen executables so pytest
10781078
can't find any third party plugins automatically. To include third party plugins
10791079
like ``pytest-timeout`` they must be imported explicitly and passed on to pytest.main.
10801080

doc/en/how-to/fixtures.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1931,7 +1931,7 @@ The same applies for the test folder level obviously.
19311931
Using fixtures from other projects
19321932
----------------------------------
19331933

1934-
Usually projects that provide pytest support will use :ref:`entry points <setuptools entry points>`,
1934+
Usually projects that provide pytest support will use :ref:`entry points <pip-installable plugins>`,
19351935
so just installing those projects into an environment will make those fixtures available for use.
19361936

19371937
In case you want to use fixtures from a project that does not use entry points, you can

doc/en/how-to/usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ You can early-load plugins (internal and external) explicitly in the command-lin
154154
The option receives a ``name`` parameter, which can be:
155155

156156
* A full module dotted name, for example ``myproject.plugins``. This dotted name must be importable.
157-
* The entry-point name of a plugin. This is the name passed to ``setuptools`` when the plugin is
157+
* The entry-point name of a plugin. This is the name passed to ``importlib`` when the plugin is
158158
registered. For example to early-load the :pypi:`pytest-cov` plugin you can use::
159159

160160
pytest -p pytest_cov

doc/en/how-to/writing_plugins.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ reporting by calling :ref:`well specified hooks <hook-reference>` of the followi
1616

1717
* builtin plugins: loaded from pytest's internal ``_pytest`` directory.
1818

19-
* :ref:`external plugins <extplugins>`: modules discovered through
20-
`setuptools entry points`_
19+
* :ref:`external plugins <extplugins>`: installed third-party modules discovered
20+
through :ref:`entry points <pip-installable plugins>` in their packaging metadata
2121

2222
* `conftest.py plugins`_: modules auto-discovered in test directories
2323

@@ -42,7 +42,8 @@ Plugin discovery order at tool startup
4242
3. by scanning the command line for the ``-p name`` option
4343
and loading the specified plugin. This happens before normal command-line parsing.
4444

45-
4. by loading all plugins registered through `setuptools entry points`_.
45+
4. by loading all plugins registered through installed third-party package
46+
:ref:`entry points <pip-installable plugins>`.
4647

4748
5. by loading all plugins specified through the :envvar:`PYTEST_PLUGINS` environment variable.
4849

@@ -142,7 +143,8 @@ Making your plugin installable by others
142143
If you want to make your plugin externally available, you
143144
may define a so-called entry point for your distribution so
144145
that ``pytest`` finds your plugin module. Entry points are
145-
a feature that is provided by :std:doc:`setuptools <setuptools:index>`.
146+
a feature that is provided by :std:doc:`packaging tools
147+
<packaging:specifications/entry-points>`.
146148

147149
pytest looks up the ``pytest11`` entrypoint to discover its
148150
plugins, thus you can make your plugin available by defining
@@ -265,8 +267,9 @@ of the variable will also be loaded as plugins, and so on.
265267
tests root directory is deprecated, and will raise a warning.
266268

267269
This mechanism makes it easy to share fixtures within applications or even
268-
external applications without the need to create external plugins using
269-
the ``setuptools``'s entry point technique.
270+
external applications without the need to create external plugins using the
271+
:std:doc:`entry point packaging metadata
272+
<packaging:guides/creating-and-discovering-plugins>` technique.
270273

271274
Plugins imported by :globalvar:`pytest_plugins` will also automatically be marked
272275
for assertion rewriting (see :func:`pytest.register_assert_rewrite`).

doc/en/reference/customize.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ and can also be used to hold pytest configuration if they have a ``[pytest]`` se
9090
setup.cfg
9191
~~~~~~~~~
9292

93-
``setup.cfg`` files are general purpose configuration files, used originally by ``distutils`` (now deprecated) and `setuptools <https://setuptools.pypa.io/en/latest/userguide/declarative_config.html>`__, and can also be used to hold pytest configuration
93+
``setup.cfg`` files are general purpose configuration files, used originally by ``distutils`` (now deprecated) and :std:doc:`setuptools <setuptools:userguide/declarative_config>`, and can also be used to hold pytest configuration
9494
if they have a ``[tool:pytest]`` section.
9595

9696
.. code-block:: ini

doc/en/reference/reference.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ Reference to all hooks which can be implemented by :ref:`conftest.py files <loca
650650
Bootstrapping hooks
651651
~~~~~~~~~~~~~~~~~~~
652652

653-
Bootstrapping hooks called for plugins registered early enough (internal and setuptools plugins).
653+
Bootstrapping hooks called for plugins registered early enough (internal and third-party plugins).
654654

655655
.. hook:: pytest_load_initial_conftests
656656
.. autofunction:: pytest_load_initial_conftests
@@ -1147,8 +1147,9 @@ When set, pytest will print tracing and debug information.
11471147

11481148
.. envvar:: PYTEST_DISABLE_PLUGIN_AUTOLOAD
11491149

1150-
When set, disables plugin auto-loading through setuptools entrypoints. Only explicitly specified plugins will be
1151-
loaded.
1150+
When set, disables plugin auto-loading through :std:doc:`entry point packaging
1151+
metadata <packaging:guides/creating-and-discovering-plugins>`. Only explicitly
1152+
specified plugins will be loaded.
11521153

11531154
.. envvar:: PYTEST_PLUGINS
11541155

src/_pytest/config/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,8 @@ def _mark_plugins_for_rewrite(self, hook) -> None:
12901290
self.pluginmanager.rewrite_hook = hook
12911291

12921292
if os.environ.get("PYTEST_DISABLE_PLUGIN_AUTOLOAD"):
1293-
# We don't autoload from setuptools entry points, no need to continue.
1293+
# We don't autoload from distribution package entry points,
1294+
# no need to continue.
12941295
return
12951296

12961297
package_files = (
@@ -1381,8 +1382,8 @@ def _preparse(self, args: List[str], addopts: bool = True) -> None:
13811382
self._consider_importhook(args)
13821383
self.pluginmanager.consider_preparse(args, exclude_only=False)
13831384
if not os.environ.get("PYTEST_DISABLE_PLUGIN_AUTOLOAD"):
1384-
# Don't autoload from setuptools entry point. Only explicitly specified
1385-
# plugins are going to be loaded.
1385+
# Don't autoload from distribution package entry point. Only
1386+
# explicitly specified plugins are going to be loaded.
13861387
self.pluginmanager.load_setuptools_entrypoints("pytest11")
13871388
self.pluginmanager.consider_env()
13881389

src/_pytest/helpconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def getpluginversioninfo(config: Config) -> List[str]:
243243
lines = []
244244
plugininfo = config.pluginmanager.list_plugin_distinfo()
245245
if plugininfo:
246-
lines.append("setuptools registered plugins:")
246+
lines.append("registered third-party plugins:")
247247
for plugin, dist in plugininfo:
248248
loc = getattr(plugin, "__file__", repr(plugin))
249249
content = f"{dist.project_name}-{dist.version} at {loc}"

0 commit comments

Comments
 (0)