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.

Author jaraco
Recipients Mekk, barry, brett.cannon, indygreg, jaraco
Date 2021-05-27.01:56:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1622080593.74.0.261431092326.issue36128@roundup.psfhosted.org>
In-reply-to
Content
The preferred API as implemented in Python 3.9 and importlib_resources 1.1 is the `files()` API. This simpler API returns a Traversable object, a pathlib-like handle to the contents of a package. This approach side-steps the issues described above. In particular, `is_resource` no longer has a purpose. Path traversal is handled naturally through `Traversable.join_path`. Resources in subdirectories are now supported.

Parent objects ('..') are allowed, but only incidentally and allowed in the same way as they're allowed for any Python code. That is, one can call `files('multiprocessing').joinpath('../../../../etc/passwd')`, but that provides no advantage over `pathlib.Path('/etc/passwd')`.

I believe this new API addresses the concerns presented.

Please open a new issue (here or in github.com/python/importlib_resources) if there are further concerns needing attention.
History
Date User Action Args
2021-05-27 01:56:33jaracosetrecipients: + jaraco, barry, brett.cannon, Mekk, indygreg
2021-05-27 01:56:33jaracosetmessageid: <1622080593.74.0.261431092326.issue36128@roundup.psfhosted.org>
2021-05-27 01:56:33jaracolinkissue36128 messages
2021-05-27 01:56:33jaracocreate