From 3a36cbd993d2eb1a4fd3c691d5b41fb1a46f7639 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 4 Mar 2021 05:41:09 -0500 Subject: [PATCH 1/2] Deprecate dict usage of SelectableGroups. --- importlib_metadata/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/importlib_metadata/__init__.py b/importlib_metadata/__init__.py index e06c70b6..da57dede 100644 --- a/importlib_metadata/__init__.py +++ b/importlib_metadata/__init__.py @@ -252,7 +252,7 @@ def values(self): return super().values() -class SelectableGroups(dict): +class SelectableGroups(Deprecated, dict): """ A backward- and forward-compatible result from entry_points that fully implements the dict interface. @@ -270,7 +270,8 @@ def _all(self): """ Reconstruct a list of all entrypoints from the groups. """ - return EntryPoints(itertools.chain.from_iterable(self.values())) + groups = super(Deprecated, self).values() + return EntryPoints(itertools.chain.from_iterable(groups)) @property def groups(self): From ae14c73354dbbeeb77038c74a5f2d2c15bc8cd25 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 4 Mar 2021 05:48:14 -0500 Subject: [PATCH 2/2] Update changelog. --- CHANGES.rst | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index a4e468c0..1fd456a3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,10 @@ +v3.8.0 +====== + +* Use of Mapping (dict) interfaces on ``SelectableGroups`` + is now flagged as deprecated. Instead, users are advised + to use the select interface for future compatibility. + v3.7.0 ====== @@ -24,12 +31,10 @@ v3.6.0 ``entry_points()`` now provides a future-compatible ``SelectableGroups`` object that supplies the above interface - but remains a dict for compatibility. + (except item access) but remains a dict for compatibility. In the future, ``entry_points()`` will return an - ``EntryPoints`` object, but provide for backward - compatibility with a deprecated ``__getitem__`` - accessor by group and a ``get()`` method. + ``EntryPoints`` object for all entry points. If passing selection parameters to ``entry_points``, the future behavior is invoked and an ``EntryPoints`` is the