classification
Title: pkgutil.get_data() is a wrapper for a deprecated class
Type: behavior Stage:
Components: Documentation, Library (Lib) Versions: Python 3.8, Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Kevin.Norris, brett.cannon, docs@python
Priority: normal Keywords:

Created on 2018-11-26 19:15 by Kevin.Norris, last changed 2018-11-27 23:43 by brett.cannon.

Messages (2)
msg330456 - (view) Author: Kevin Norris (Kevin.Norris) Date: 2018-11-26 19:15
pkgutil.get_data()'s documentation[1] says it is a wrapper for importlib.abc.ResourceLoader.get_data(), but the latter's documentation[2] says the whole class is deprecated since 3.7.

Please either:

A. Formally deprecate pkgutil.get_data() (and ideally provide a "nice" alternative wrapper, so that I don't have to muck about with importlib's endless heterarchy of opaque objects which return other opaque objects).
B. Modify pkgutil.get_data() to use ResourceReader instead of ResourceLoader.
C. (A) or (B) has already been done, just document it.

[1]: https://docs.python.org/3/library/pkgutil.html#pkgutil.get_data
[2]: https://docs.python.org/3.8/library/importlib.html#importlib.abc.ResourceLoader
msg330561 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2018-11-27 23:43
You can use importlib.resources to read data files and such from within a package as an alternative.
History
Date User Action Args
2018-11-27 23:43:17brett.cannonsetnosy: + brett.cannon
messages: + msg330561
2018-11-26 19:15:58Kevin.Norriscreate