[New-bugs-announce] [issue45547] Modenize the importlib loaders

Filipe Laíns report at bugs.python.org
Wed Oct 20 19:15:10 EDT 2021


New submission from Filipe Laíns <lains at riseup.net>:

ResourceLoader[1] is deprecated in favor of ResourceReader, which itself is surpassed by TraversableResources.

Would it make sense to replace ResourceLoader usages with ResourceReader in the importlib loaders?
And perhaps, would it make sense to replace them with the files()/Traversable protocol instead?

IMO this could simplify the code a bit, but that's subjective I guess, and better re-use the bytecode caching mechanism in SourceLoader, by providing an equivalent based on files()/Traversable instead.

This could also help push to add support for non filesystem based loaders in other parts of the code, like py_compile, which currently only supports operations on the filesystem.

Is this something we are interested in -- modernizing the importlib loaders with, arguably, better abstractions -- or do we want to keep the old protocols around?

[1] https://docs.python.org/3/library/importlib.html#importlib.abc.ResourceLoader

----------
messages: 404540
nosy: FFY00, barry, brett.cannon, eric.snow, jaraco, ncoghlan
priority: normal
severity: normal
status: open
title: Modenize the importlib loaders

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


More information about the New-bugs-announce mailing list