Skip to content

Check which attributes have been loaded without triggering imports #51

Open
@lagru

Description

@lagru

Is there a mechanism to check which objects have been loaded and which ones are still in the "lazy" state? Looking through the code and inspecting the objects returned by lazy.attach_stub it didn't see an obvious way to do so.

Maybe this could be addressed by making attach not return simple functions but objects. E.g.

__getattr__, __dir__, _ = lazy.attach_stub(__name__, __file__)
__getattr__.loaded_names  # return names which were already loaded

I think this would be very helpful in debugging and testing that lazy loading actually works as intended.

I'd be happy to work on this if there is interest!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions