This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Document what are resources in importlib.resources
Type: Stage: patch review
Components: Documentation Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: FFY00, docs@python, jaraco
Priority: normal Keywords: patch

Created on 2021-05-18 00:05 by FFY00, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 26280 closed FFY00, 2021-05-21 14:32
Messages (2)
msg393849 - (view) Author: Filipe Laíns (FFY00) * (Python triager) Date: 2021-05-18 00:05
It would be good to explain what constitutes a resource in the importlib.resources documentation.

As per the current implementation, they should be defined as arbitrary files contained in the package. Is this correct?
msg394218 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2021-05-23 18:56
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.
History
Date User Action Args
2022-04-11 14:59:45adminsetgithub: 88330
2021-05-23 18:56:35jaracosetmessages: + msg394218
2021-05-21 14:32:25FFY00setkeywords: + patch
stage: patch review
pull_requests: + pull_request24886
2021-05-18 00:05:54FFY00create