Skip to content

Modernize the importlib loaders #89710

Description

@FFY00
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 = []

Activity

  1. FFY00 commented on Oct 20, 2021

    @FFY00
    MemberAuthor

    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

  2. changed the title [-]Modenize the importlib loaders[/-] [+]Modernize the importlib loaders[/+] on Oct 20, 2021
  3. changed the title [-]Modenize the importlib loaders[/-] [+]Modernize the importlib loaders[/+] on Oct 20, 2021
  4. brettcannon commented on Oct 21, 2021

    @brettcannon
    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.

  5. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions