From 4c7f6365f2dde09c11e72db67d0f615231d64c19 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 14 Oct 2026 17:35:16 +0300 Subject: [PATCH] Preparing release 1.7.0 --- CHANGELOG.rst | 114 ++++++++++++++++++++++++++++++++++++++ changelog/170.feature.rst | 3 - changelog/186.doc.rst | 1 - changelog/315.bugfix.rst | 1 - changelog/417.trivial.rst | 1 - changelog/424.bugfix.rst | 5 -- changelog/431.bugfix.rst | 1 - changelog/442.bugfix.rst | 4 -- changelog/590.trivial.rst | 1 - changelog/629.bugfix.rst | 1 - changelog/632.removal.rst | 1 - changelog/681.bugfix.rst | 3 - changelog/691.trivial.rst | 1 - changelog/695.bugfix.rst | 1 - changelog/701.bugfix.rst | 9 --- changelog/703.trivial.rst | 4 -- changelog/727.bugfix.rst | 1 - changelog/729.feature.rst | 5 -- changelog/731.bugfix.rst | 1 - changelog/733.bugfix.rst | 1 - changelog/755.bugfix.rst | 1 - changelog/757.bugfix.rst | 2 - changelog/759.bugfix.rst | 2 - changelog/776.trivial.rst | 1 - 24 files changed, 114 insertions(+), 51 deletions(-) delete mode 100644 changelog/170.feature.rst delete mode 100644 changelog/186.doc.rst delete mode 100644 changelog/315.bugfix.rst delete mode 100644 changelog/417.trivial.rst delete mode 100644 changelog/424.bugfix.rst delete mode 100644 changelog/431.bugfix.rst delete mode 100644 changelog/442.bugfix.rst delete mode 100644 changelog/590.trivial.rst delete mode 100644 changelog/629.bugfix.rst delete mode 100644 changelog/632.removal.rst delete mode 100644 changelog/681.bugfix.rst delete mode 100644 changelog/691.trivial.rst delete mode 100644 changelog/695.bugfix.rst delete mode 100644 changelog/701.bugfix.rst delete mode 100644 changelog/703.trivial.rst delete mode 100644 changelog/727.bugfix.rst delete mode 100644 changelog/729.feature.rst delete mode 100644 changelog/731.bugfix.rst delete mode 100644 changelog/733.bugfix.rst delete mode 100644 changelog/755.bugfix.rst delete mode 100644 changelog/757.bugfix.rst delete mode 100644 changelog/759.bugfix.rst delete mode 100644 changelog/776.trivial.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 061d025a..fc7bcac4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -21,6 +21,120 @@ Versions follow `Semantic Versioning `_ (``.. .. towncrier release notes start +pluggy 1.7.0 (2026-10-14) +========================= + +Deprecations and Removals +------------------------- + +- `#632 `_: Hookspec methods defined without ``self`` as the first parameter now emit a :class:`DeprecationWarning`. Add ``self`` as the first parameter or use ``@staticmethod``. + + + +Features +-------- + +- `#170 `_: Hookspecs can now declare default values for arguments, using the usual ``def myhook(myarg="default")`` syntax. + This is mainly a backward compatibility feature, to allow a hookspec to add new parameters to an existing hook without breaking existing *callers*. + See :ref:`hookspec_arg_default` for details. + + +- `#729 `_: Tracing now adds detail where ``str()`` is ambiguous: empty strings and strings containing + whitespace are quoted, and enums and paths show their ``repr()``. + + A value spanning several lines is now displayed as a block instead of running into the + surrounding trace. + + + +Bug Fixes +--------- + +- `#629 `_: Fix hooks failing to register on Python 3.14+ when type annotations use forward references. + + +- `#315 `_: Source archives created by ``git archive`` (including GitHub's "Source code" downloads) now carry version information, so building pluggy from them no longer fails with a missing version. + + +- `#442 `_: With the addition of default values for hookspec arguments, we also changed the precedence of default values for *hookimpl* arguments. + Previously, if a hookimpl function declared a default for an argument, it was always used, even if the *hook call* passed an explicit value. + Now the precedence is changed to: hook call passed value > hookspec default value > hookimpl default value. + See :ref:`hookimpl_arg_defaults`. + + +- `#701 `_: Hookimpls and hookspecs are now discovered via :func:`inspect.getattr_static`, so + properties, ``cached_property`` and other descriptors are no longer executed while + scanning a plugin. Hooks declared through such a descriptor are not supported. + + As a side effect, ``@hookimpl``/``@hookspec`` applied *above* ``@classmethod`` or + ``@staticmethod`` is now picked up; previously the marker sat on the wrapper where + ``getattr()`` never saw it. Callables stored directly on a plugin instance -- in its + ``__dict__`` or in a ``__slots__`` slot -- keep being called exactly as ``getattr()`` + returned them, i.e. without an implicit ``self``. + + +- `#431 `_: Fix ``HookCaller._remove_plugin()`` to remove all hook implementations for a plugin in a single call, instead of only the first one. Also fix ``PluginManager.get_hookcallers()`` to not return duplicate ``HookCaller`` entries when a plugin has multiple implementations on the same hook (e.g. via ``specname``). + + +- `#695 `_: Fixed :func:`~pluggy.PluginManager.subset_hook_caller()` not excluding removed plugins which use :func:`@hookiml(specname="...") `. + + +- `#424 `_: Tracing no longer breaks hook execution when a traced object has a broken ``__repr__`` + or ``__str__``. Such a value is now rendered as + ``<[RuntimeError(...) raised in str()] Broken object at 0x...>``, in the same style + pytest uses for unpresentable objects, instead of propagating the exception out of the + hook call. + + +- `#681 `_: Tracing no longer crashes with ``UnicodeEncodeError`` when a hook argument or return + value contains lone surrogates; they are escaped with ``backslashreplace`` before the + message reaches the writer. Trace output is otherwise unchanged. + + +- `#727 `_: Fix the warning for hookspec arguments missing from a hook call being attributed to pluggy's own frame instead of to the code making the call. This affected ``HookCaller.__call__``, ``call_historic`` and ``call_extra``. + + +- `#731 `_: :func:`PluginManager.register(None) ` is now ignored instead of having some weird behaviors. + + +- `#733 `_: :meth:`PluginManager.register() ` now validates all hook implementations of a plugin before registering any of them, so a plugin that fails validation no longer stays partially registered. + + +- `#755 `_: Skip already registered entry-point plugins without evaluating the plugin object's truthiness. + + +- `#757 `_: Restore the project URLs in the package metadata, which were lost in pluggy 1.6.0 when the packaging configuration moved to ``pyproject.toml``. + Links to the documentation, changelog, issue tracker and funding page were added as well. + + +- `#759 `_: :meth:`PluginManager.unregister() ` now raises :exc:`ValueError` when both ``plugin`` and ``name`` are given but refer to different plugins, instead of removing one plugin's hook implementations and another plugin's registry entry. + It also fully unregisters plugin objects that are falsy (e.g. define ``__len__`` returning ``0``); previously their name stayed in the registry. + + +- `#186 `_: Fixed broken external documentation references in the list of projects using pluggy. + + +Trivial/Internal Changes +------------------------ + +- `#417 `_: Fix the ``tox -e docs`` build, which failed under ``sphinx-build -W`` because nitpicky mode reported unresolved references to the private names. + + +- `#590 `_: The ``pluggy.__version__`` variable is now dynamically provided via a module-level ``__getattr__`` implementation, using ``importlib`` to obtain the installed version. + + +- `#691 `_: Fix outdated links in ``README.rst``. + + +- `#703 `_: The internal ``pluggy._hooks`` module was split into role-specific modules + (``_caller``, ``_config``, ``_decorators``, ``_execution`` and ``_impl``). + ``pluggy._hooks`` remains as a re-export shim, and the public API is + unchanged. + + +- `#776 `_: Building ``pluggy`` without git metadata now yields the placeholder version ``1.6.0+fallback`` instead of failing, so Dependabot relocks no longer resolve ``pluggy`` as ``0.0.0`` and silently downgrade pytest and tox in ``uv.lock``. ``tox`` was dropped from the ``dev`` dependency group; run it as a tool with ``uvx tox``. + + pluggy 1.6.0 (2025-05-15) ========================= diff --git a/changelog/170.feature.rst b/changelog/170.feature.rst deleted file mode 100644 index 761dbad2..00000000 --- a/changelog/170.feature.rst +++ /dev/null @@ -1,3 +0,0 @@ -Hookspecs can now delcare default values for arguments, using the usual ``def myhook(myarg="default")`` syntax. -This is mainly a backward compatibility feature, to allow a hookspec to add new parameters to an existing hook without breaking existing *callers*. -See :ref:`hookspec_arg_default` for details. diff --git a/changelog/186.doc.rst b/changelog/186.doc.rst deleted file mode 100644 index 31f42ade..00000000 --- a/changelog/186.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed broken external documentation references in the list of projects using pluggy. diff --git a/changelog/315.bugfix.rst b/changelog/315.bugfix.rst deleted file mode 100644 index 785db0fb..00000000 --- a/changelog/315.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Source archives created by ``git archive`` (including GitHub's "Source code" downloads) now carry version information, so building pluggy from them no longer fails with a missing version. diff --git a/changelog/417.trivial.rst b/changelog/417.trivial.rst deleted file mode 100644 index 00d15ce8..00000000 --- a/changelog/417.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Fix the ``tox -e docs`` build, which failed under ``sphinx-build -W`` because nitpicky mode reported unresolved references to the private names ``_tracing.TagTracerSub``, ``DistFacade`` and ``_Plugin``. diff --git a/changelog/424.bugfix.rst b/changelog/424.bugfix.rst deleted file mode 100644 index 96b3ec6d..00000000 --- a/changelog/424.bugfix.rst +++ /dev/null @@ -1,5 +0,0 @@ -Tracing no longer breaks hook execution when a traced object has a broken ``__repr__`` -or ``__str__``. Such a value is now rendered as -``<[RuntimeError(...) raised in str()] Broken object at 0x...>``, in the same style -pytest uses for unpresentable objects, instead of propagating the exception out of the -hook call. diff --git a/changelog/431.bugfix.rst b/changelog/431.bugfix.rst deleted file mode 100644 index 5c813c2a..00000000 --- a/changelog/431.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix ``HookCaller._remove_plugin()`` to remove all hook implementations for a plugin in a single call, instead of only the first one. Also fix ``PluginManager.get_hookcallers()`` to not return duplicate ``HookCaller`` entries when a plugin has multiple implementations on the same hook (e.g. via ``specname``). diff --git a/changelog/442.bugfix.rst b/changelog/442.bugfix.rst deleted file mode 100644 index 26c4caa9..00000000 --- a/changelog/442.bugfix.rst +++ /dev/null @@ -1,4 +0,0 @@ -With the addition of default values for hookspec arguments, we also changed the precedence of default values for *hookimpl* arguments. -Previously, if a hookimpl function declared a default for an argument, it was always used, even if the *hook call* passed an explicit value. -Now the precedence is changed to: hook call passed value > hookspec default value > hookimpl default value. -See :ref:`hookimpl_arg_defaults`. diff --git a/changelog/590.trivial.rst b/changelog/590.trivial.rst deleted file mode 100644 index 276be0df..00000000 --- a/changelog/590.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -The ``pluggy.__version__`` variable is now dynamically provided via a module-level ``__getattr__`` implementation, using ``importlib`` to obtain the installed version. diff --git a/changelog/629.bugfix.rst b/changelog/629.bugfix.rst deleted file mode 100644 index 88c96c1f..00000000 --- a/changelog/629.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix hooks failing to register on Python 3.14+ when type annotations use forward references. diff --git a/changelog/632.removal.rst b/changelog/632.removal.rst deleted file mode 100644 index 0e6929b4..00000000 --- a/changelog/632.removal.rst +++ /dev/null @@ -1 +0,0 @@ -Hookspec methods defined without ``self`` as the first parameter now emit a :class:`DeprecationWarning`. Add ``self`` as the first parameter or use ``@staticmethod``. diff --git a/changelog/681.bugfix.rst b/changelog/681.bugfix.rst deleted file mode 100644 index f2d94a4c..00000000 --- a/changelog/681.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -Tracing no longer crashes with ``UnicodeEncodeError`` when a hook argument or return -value contains lone surrogates; they are escaped with ``backslashreplace`` before the -message reaches the writer. Trace output is otherwise unchanged. diff --git a/changelog/691.trivial.rst b/changelog/691.trivial.rst deleted file mode 100644 index 0ded812f..00000000 --- a/changelog/691.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Fix outdated links in ``README.rst``: update ``http://pytest.org`` to ``https://pytest.org``, ``tox.readthedocs.org`` to ``tox.wiki``, ``http://doc.devpi.net`` to ``https://doc.devpi.net``, and the Black badge link from ``ambv/black`` to ``psf/black``. diff --git a/changelog/695.bugfix.rst b/changelog/695.bugfix.rst deleted file mode 100644 index c1263f29..00000000 --- a/changelog/695.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed :func:`~pluggy.PluginManager.subset_hook_caller()` not excluding removed plugins which use :func:`@hookiml(specname="...") `. diff --git a/changelog/701.bugfix.rst b/changelog/701.bugfix.rst deleted file mode 100644 index c612073d..00000000 --- a/changelog/701.bugfix.rst +++ /dev/null @@ -1,9 +0,0 @@ -Hookimpls and hookspecs are now discovered via :func:`inspect.getattr_static`, so -properties, ``cached_property`` and other descriptors are no longer executed while -scanning a plugin. Hooks declared through such a descriptor are not supported. - -As a side effect, ``@hookimpl``/``@hookspec`` applied *above* ``@classmethod`` or -``@staticmethod`` is now picked up; previously the marker sat on the wrapper where -``getattr()`` never saw it. Callables stored directly on a plugin instance -- in its -``__dict__`` or in a ``__slots__`` slot -- keep being called exactly as ``getattr()`` -returned them, i.e. without an implicit ``self``. diff --git a/changelog/703.trivial.rst b/changelog/703.trivial.rst deleted file mode 100644 index 14ec81aa..00000000 --- a/changelog/703.trivial.rst +++ /dev/null @@ -1,4 +0,0 @@ -The internal ``pluggy._hooks`` module was split into role-specific modules -(``_caller``, ``_config``, ``_decorators``, ``_execution`` and ``_impl``). -``pluggy._hooks`` remains as a re-export shim, and the public API is -unchanged. diff --git a/changelog/727.bugfix.rst b/changelog/727.bugfix.rst deleted file mode 100644 index 0e27bcc0..00000000 --- a/changelog/727.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix the warning for hookspec arguments missing from a hook call being attributed to pluggy's own frame instead of to the code making the call. This affected ``HookCaller.__call__``, ``call_historic`` and ``call_extra``. diff --git a/changelog/729.feature.rst b/changelog/729.feature.rst deleted file mode 100644 index 33b57905..00000000 --- a/changelog/729.feature.rst +++ /dev/null @@ -1,5 +0,0 @@ -Tracing now adds detail where ``str()`` is ambiguous: empty strings and strings containing -whitespace are quoted, and enums and paths show their ``repr()``. - -A value spanning several lines is now displayed as a block instead of running into the -surrounding trace. diff --git a/changelog/731.bugfix.rst b/changelog/731.bugfix.rst deleted file mode 100644 index 660684bc..00000000 --- a/changelog/731.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -:func:`PluginManager.register(None) ` is now ignored instead of having some weird behaviors. diff --git a/changelog/733.bugfix.rst b/changelog/733.bugfix.rst deleted file mode 100644 index ba4902c3..00000000 --- a/changelog/733.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -:meth:`PluginManager.register() ` now validates all hook implementations of a plugin before registering any of them, so a plugin that fails validation no longer stays partially registered. diff --git a/changelog/755.bugfix.rst b/changelog/755.bugfix.rst deleted file mode 100644 index 262d8f82..00000000 --- a/changelog/755.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Skip already registered entry-point plugins without evaluating the plugin object's truthiness. diff --git a/changelog/757.bugfix.rst b/changelog/757.bugfix.rst deleted file mode 100644 index c3c22b6d..00000000 --- a/changelog/757.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Restore the project URLs in the package metadata, which were lost in pluggy 1.6.0 when the packaging configuration moved to ``pyproject.toml``. -PyPI and tools that map a distribution back to its source repository can find it again; links to the documentation, changelog, issue tracker and funding page were added as well. diff --git a/changelog/759.bugfix.rst b/changelog/759.bugfix.rst deleted file mode 100644 index 1e754a55..00000000 --- a/changelog/759.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -:meth:`PluginManager.unregister() ` now raises :exc:`ValueError` when both ``plugin`` and ``name`` are given but refer to different plugins, instead of removing one plugin's hook implementations and another plugin's registry entry. -It also fully unregisters plugin objects that are falsy (e.g. define ``__len__`` returning ``0``); previously their name stayed in the registry. diff --git a/changelog/776.trivial.rst b/changelog/776.trivial.rst deleted file mode 100644 index e691e927..00000000 --- a/changelog/776.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Building ``pluggy`` without git metadata now yields the placeholder version ``1.6.0+fallback`` instead of failing, so Dependabot relocks no longer resolve ``pluggy`` as ``0.0.0`` and silently downgrade pytest and tox in ``uv.lock``. ``tox`` was dropped from the ``dev`` dependency group; run it as a tool with ``uvx tox``.