Skip to content

Autocompletion breaks lazy loading #155

@ego-thales

Description

@ego-thales

Hello,

First of all, thanks for your package, it's very elegant and very practical! I especially love the approach using stub files, which simply requires renaming any previous __init__.py to __init__.pyi before replacing __init__.py with a generic lazy.attach_stub(__name__, __file__) call.

I found out that if I have two lazy loaded classes AA and AB in the same namespace, when typing A and trying autocompletion with tab, then both AA and AB are actually loaded. I was surprised since I thought the fact that python knows __all__ would be enough. However, I now realize that since the interpreter adds a ( when autocompleting, it must know something more.

Is this an issue that cannot be solved because of what autocompletion does, or is it actionable in some way?

Thanks in advance!
Élie

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions