diff options
author | Barry Warsaw <barry@python.org> | 2018-02-16 15:45:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-16 15:45:39 (GMT) |
commit | 997b8c140e768c849fa99d172245a7688af20a89 (patch) | |
tree | 2fb7aa7948e31475096df98f4a827034205dfd9f /Doc | |
parent | 7745ec4e356ac1f4eaf43b155f4482c20a907d48 (diff) | |
download | cpython-997b8c140e768c849fa99d172245a7688af20a89.zip cpython-997b8c140e768c849fa99d172245a7688af20a89.tar.gz cpython-997b8c140e768c849fa99d172245a7688af20a89.tar.bz2 |
Update and sync importlib.resources documentation (#5694)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/importlib.rst | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index c80f460..db75f69 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -369,9 +369,9 @@ ABC hierarchy:: An abstract base class for a :term:`loader`. See :pep:`302` for the exact definition for a loader. - For loaders that wish to support resource reading, they should - implement a ``get_resource_reader(fullname)`` method as specified - by :class:`importlib.abc.ResourceReader`. + Loaders that wish to support resource reading should implement a + ``get_resource_reader(fullname)`` method as specified by + :class:`importlib.abc.ResourceReader`. .. versionchanged:: 3.7 Introduced the optional ``get_resource_reader()`` method. @@ -813,8 +813,25 @@ Resources are roughly akin to files inside directories, though it's important to keep in mind that this is just a metaphor. Resources and packages **do not** have to exist as physical files and directories on the file system. -Loaders can support resources by implementing the :class:`ResourceReader` -abstract base class. +.. note:: + + This module provides functionality similar to `pkg_resources + <https://setuptools.readthedocs.io/en/latest/pkg_resources.html>`_ `Basic + Resource Access + <http://setuptools.readthedocs.io/en/latest/pkg_resources.html#basic-resource-access>`_ + without the performance overhead of that package. This makes reading + resources included in packages easier, with more stable and consistent + semantics. + + The standalone backport of this module provides more information + on `using importlib.resources + <http://importlib-resources.readthedocs.io/en/latest/using.html>`_ and + `migrating from pkg_resources to importlib.resources + <http://importlib-resources.readthedocs.io/en/latest/migration.html>`_. + +Loaders that wish to support resource reading should implement a +``get_resource_reader(fullname)`` method as specified by +:class:`importlib.abc.ResourceReader`. The following types are defined. |