Skip to content

Add a load_parents argument to importlib.find_loader() #60696

Closed

Description

@brettcannon
BPO 16492
Nosy @brettcannon, @asvetlov, @ericsnowcurrently
Superseder
  • bpo-19944: Make importlib.find_spec load packages as needed
  • 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 = <Date 2013-12-19.19:11:45.009>
    created_at = <Date 2012-11-17.14:38:51.418>
    labels = ['type-feature', 'library']
    title = 'Add a load_parents argument to importlib.find_loader()'
    updated_at = <Date 2013-12-19.19:11:44.991>
    user = 'https://github.com/brettcannon'

    bugs.python.org fields:

    activity = <Date 2013-12-19.19:11:44.991>
    actor = 'eric.snow'
    assignee = 'none'
    closed = True
    closed_date = <Date 2013-12-19.19:11:45.009>
    closer = 'eric.snow'
    components = ['Library (Lib)']
    creation = <Date 2012-11-17.14:38:51.418>
    creator = 'brett.cannon'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 16492
    keywords = []
    message_count = 2.0
    messages = ['175742', '206630']
    nosy_count = 3.0
    nosy_names = ['brett.cannon', 'asvetlov', 'eric.snow']
    pr_nums = []
    priority = 'low'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '19944'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue16492'
    versions = ['Python 3.4']

    Activity

    1. brettcannon commented on Nov 17, 2012

      @brettcannon
      MemberAuthor

      To make using importlib.find_loader() easier, there should be a flag that says to automatically import all parent packages for the desired submodule so as to not force the user to do it::

        def find_loader(name, path=None, *, load_parents=False): ...

      That way people who are okay with loading some packages implicitly to get at a specific loader can do so without having to do boilerplate name.split('.'); import each parent code. Also means people don't have to worry about the path argument (unless they explicitly want to trigger loading from a different location).

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Nov 17, 2012
    3. ericsnowcurrently commented on Dec 19, 2013

      @ericsnowcurrently
      Member

      find_loader() is now deprecated and we're going to support auto-importing parent modules in find_spec() (see bpo-19944)

    4. 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

      Labels

      stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions