Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize the importlib loaders #89710

Open
FFY00 opened this issue Oct 20, 2021 · 2 comments
Open

Modernize the importlib loaders #89710

FFY00 opened this issue Oct 20, 2021 · 2 comments
Labels
topic-importlib type-feature A feature request or enhancement

Comments

@FFY00
Copy link
Member

FFY00 commented Oct 20, 2021

BPO 45547
Nosy @warsaw, @brettcannon, @jaraco, @ncoghlan, @ericsnowcurrently, @FFY00

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-10-20.23:15:10.249>
labels = []
title = 'Modernize the importlib loaders'
updated_at = <Date 2021-10-21.21:24:44.368>
user = 'https://github.com/FFY00'

bugs.python.org fields:

activity = <Date 2021-10-21.21:24:44.368>
actor = 'brett.cannon'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = []
creation = <Date 2021-10-20.23:15:10.249>
creator = 'FFY00'
dependencies = []
files = []
hgrepos = []
issue_num = 45547
keywords = []
message_count = 2.0
messages = ['404540', '404666']
nosy_count = 6.0
nosy_names = ['barry', 'brett.cannon', 'jaraco', 'ncoghlan', 'eric.snow', 'FFY00']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue45547'
versions = []

@FFY00
Copy link
Member Author

FFY00 commented Oct 20, 2021

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

@FFY00 FFY00 changed the title Modenize the importlib loaders Modernize the importlib loaders Oct 20, 2021
@FFY00 FFY00 changed the title Modenize the importlib loaders Modernize the importlib loaders Oct 20, 2021
@brettcannon
Copy link
Member

It's an interesting question. Probably should add the new APIs. As for dropping the old ones, we would have to check if we have been raising deprecation warnings as appropriate or if it's just a documentation thing.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@AlexWaygood AlexWaygood added the type-feature A feature request or enhancement label Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-importlib type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants