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

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

Closed
brettcannon opened this issue Nov 17, 2012 · 2 comments
Closed

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

brettcannon opened this issue Nov 17, 2012 · 2 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@brettcannon
Copy link
Member

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']

    @brettcannon
    Copy link
    Member Author

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

    @brettcannon brettcannon added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 17, 2012
    @ericsnowcurrently
    Copy link
    Member

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

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

    No branches or pull requests

    2 participants