Skip to content

gh-121604: fix ResourceLoader deprecation warning message #128859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Doc/library/importlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@
An abstract base class for a :term:`loader`.
See :pep:`302` for the exact definition for a loader.

Loaders that wish to support resource reading should implement a

Check warning on line 308 in Doc/library/importlib.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: get_resource_reader [ref.meth]
:meth:`get_resource_reader` method as specified by
:class:`importlib.resources.abc.ResourceReader`.
:class:`importlib.resources.abc.TraversableResources`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it is documented in the importlib.resources.abc.ResourceReader description.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But ResourceReader is scheduled for removal in 3.14

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When ResourceReader has been removed, the documentation of its methods and of get_resource_reader() should be moved to the TraversableResources description. For now, get_resource_reader() is described with ResourceReader, and the code that implements get_resource_reader() returning ResourceReader still works (but emits a warning).

Copy link
Member

@tomasr8 tomasr8 Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not anymore, see the later comments in #97850

(Responding to Thomas' comment)


.. versionchanged:: 3.7
Introduced the optional :meth:`get_resource_reader` method.
Expand Down Expand Up @@ -386,7 +386,7 @@

.. deprecated:: 3.7
This ABC is deprecated in favour of supporting resource loading
through :class:`importlib.resources.abc.ResourceReader`.
through :class:`importlib.resources.abc.TraversableResources`.

.. abstractmethod:: get_data(path)

Expand Down
2 changes: 1 addition & 1 deletion Lib/importlib/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self):
import warnings
warnings.warn('importlib.abc.ResourceLoader is deprecated in '
'favour of supporting resource loading through '
'importlib.resources.abc.ResourceReader.',
'importlib.resources.abc.TraversableResources.',
DeprecationWarning, stacklevel=2)
super().__init__()

Expand Down
Loading