diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2021-11-24 07:51:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-24 07:51:37 (GMT) |
commit | d5cd2effa69551c6bc7edfef8a414d545dea9117 (patch) | |
tree | 038c3dfa9d1ddb4baf1d1b326c5c308866de2b63 /Doc | |
parent | 324527012fa1078428a6207918640cf860e28c81 (diff) | |
download | cpython-d5cd2effa69551c6bc7edfef8a414d545dea9117.zip cpython-d5cd2effa69551c6bc7edfef8a414d545dea9117.tar.gz cpython-d5cd2effa69551c6bc7edfef8a414d545dea9117.tar.bz2 |
bpo-45514: Deprecate importlib resources legacy functions. (GH-29036)
* bpo-45514: Apply changes from importlib_resources@a3ef4128c6
* Mark legacy functions as deprecated in the docs and link to the migration docs in importlib_resources docs.
* Apply changes from importlib_resources@329ae9d5f2c.
* Indicate importlib.resources as a module.
Co-authored-by: Filipe LaĆns <lains@riseup.net>
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/importlib.rst | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 59c8c64..347e08e 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -917,7 +917,9 @@ not** have to exist as physical files and directories on the file system. 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>`_. + <http://importlib-resources.readthedocs.io/en/latest/migration.html>`_ + and + `migrating legacy usage <https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy>`_. Loaders that wish to support resource reading should implement a ``get_resource_reader(fullname)`` method as specified by @@ -979,6 +981,8 @@ The following functions are available. sub-resources (i.e. it cannot be a directory). This function returns a ``typing.BinaryIO`` instance, a binary I/O stream open for reading. + .. deprecated:: 3.11 + .. function:: open_text(package, resource, encoding='utf-8', errors='strict') @@ -994,6 +998,8 @@ The following functions are available. This function returns a ``typing.TextIO`` instance, a text I/O stream open for reading. + .. deprecated:: 3.11 + .. function:: read_binary(package, resource) @@ -1006,6 +1012,8 @@ The following functions are available. sub-resources (i.e. it cannot be a directory). This function returns the contents of the resource as :class:`bytes`. + .. deprecated:: 3.11 + .. function:: read_text(package, resource, encoding='utf-8', errors='strict') @@ -1019,6 +1027,8 @@ The following functions are available. have the same meaning as with built-in :func:`open`. This function returns the contents of the resource as :class:`str`. + .. deprecated:: 3.11 + .. function:: path(package, resource) @@ -1034,6 +1044,8 @@ The following functions are available. within *package*; it may not contain path separators and it may not have sub-resources (i.e. it cannot be a directory). + .. deprecated:: 3.11 + .. function:: is_resource(package, name) @@ -1042,6 +1054,8 @@ The following functions are available. *package* is either a name or a module object which conforms to the ``Package`` requirements. + .. deprecated:: 3.11 + .. function:: contents(package) @@ -1052,6 +1066,8 @@ The following functions are available. *package* is either a name or a module object which conforms to the ``Package`` requirements. + .. deprecated:: 3.11 + :mod:`importlib.machinery` -- Importers and path hooks ------------------------------------------------------ |