[issue44164] Document what are resources in importlib.resources

Jason R. Coombs report at bugs.python.org
Sun May 23 14:56:35 EDT 2021


Jason R. Coombs <jaraco at jaraco.com> added the comment:

I've not previously seen a definition of resources. The original implementation of importlib_resources excluded 'directories' as resources and excluded support for resources being in subdirectories (only files in packages were allowed). Now resources can be found in subdirectories that are not packages and in namesepace packages. I'd describe resources thus:

"Resources" are file-like resources associated with a module[1] or package in Python. The resources may be contained directly in a package or within a subdirectory contained in that package. Resources may be text or binary. As a result, Python module sources (.py) of a package and compilation artifacts (__pycache__) are technically de-facto resources of that package. In practice, however, resources are primarily those non-Python artifacts exposed specifically by the package author.


[1] Resources associated with top-level modules are not yet supported by importlib[._]resources (https://github.com/python/importlib_resources/issues/203) but were supported by pkg_resources.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44164>
_______________________________________


More information about the Python-bugs-list mailing list