Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 997b8c1

Browse files
authored
Update and sync importlib.resources documentation (#5694)
1 parent 7745ec4 commit 997b8c1

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

Doc/library/importlib.rst

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,9 @@ ABC hierarchy::
369369
An abstract base class for a :term:`loader`.
370370
See :pep:`302` for the exact definition for a loader.
371371

372-
For loaders that wish to support resource reading, they should
373-
implement a ``get_resource_reader(fullname)`` method as specified
374-
by :class:`importlib.abc.ResourceReader`.
372+
Loaders that wish to support resource reading should implement a
373+
``get_resource_reader(fullname)`` method as specified by
374+
:class:`importlib.abc.ResourceReader`.
375375

376376
.. versionchanged:: 3.7
377377
Introduced the optional ``get_resource_reader()`` method.
@@ -813,8 +813,25 @@ Resources are roughly akin to files inside directories, though it's important
813813
to keep in mind that this is just a metaphor. Resources and packages **do
814814
not** have to exist as physical files and directories on the file system.
815815

816-
Loaders can support resources by implementing the :class:`ResourceReader`
817-
abstract base class.
816+
.. note::
817+
818+
This module provides functionality similar to `pkg_resources
819+
<https://setuptools.readthedocs.io/en/latest/pkg_resources.html>`_ `Basic
820+
Resource Access
821+
<http://setuptools.readthedocs.io/en/latest/pkg_resources.html#basic-resource-access>`_
822+
without the performance overhead of that package. This makes reading
823+
resources included in packages easier, with more stable and consistent
824+
semantics.
825+
826+
The standalone backport of this module provides more information
827+
on `using importlib.resources
828+
<http://importlib-resources.readthedocs.io/en/latest/using.html>`_ and
829+
`migrating from pkg_resources to importlib.resources
830+
<http://importlib-resources.readthedocs.io/en/latest/migration.html>`_.
831+
832+
Loaders that wish to support resource reading should implement a
833+
``get_resource_reader(fullname)`` method as specified by
834+
:class:`importlib.abc.ResourceReader`.
818835

819836
The following types are defined.
820837

0 commit comments

Comments
 (0)