-
Notifications
You must be signed in to change notification settings - Fork 5
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
MAINT: Use lazy_loader to speed up plopp first import #405
Conversation
'Camera', | ||
'Node', | ||
'View', | ||
'backends', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right that the backends
is now gone from the __all__
?
I don't know if it's important or not...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it should be fine I think. As backends
is still there explicitly in __init__.py
.
It's not in the __all__
list but it is still accesible.
In [1]: import plopp
In [2]: plopp.backends
Out[2]: BackendManager({'2d': 'matplotlib', '3d': 'pythreejs'})
In [3]: 'backends' in plopp.__all__
Out[3]: False
|
||
from .graph import show_graph | ||
from .helpers import node, widget_node | ||
from .node_class import Node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for renaming the node
file to node_class
? Was there a clash with something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, helpers.node
was clashing with node.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should just move the Node
and the helpers in a common file? (could be node.py
or a differently named file).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do that in a new PR? I want to make this PR minimal so it's easy to revert in case this messes things up downstream.
In the spirit of scipp/scippneutron#596, this adds lazy_loader to plopp.
Import time goes from
to
(not a very scientific comparison but still seems like a decent speedup).
The
attach_stub
function works by parsing the.pyi
files to infer submodules and functions to expose. It also makes sure that static typecheckers and IDE don't complain too much.