-
-
Notifications
You must be signed in to change notification settings - Fork 671
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
implement lazy loading in toga_core #2686
Conversation
this comes behind #2584 , it was very messy and would require lots of reverts, please see there for history and revelance. |
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.
The core of this looks good; a couple of minor cleanups flagged inline.
This list should be in alphabetical order by module and then by name, as in toga/__init__.py. beeware#2584 (comment) including preserving the historical sort order (i.e., sorted by the full import path of the original module), with interleaved comments highlighting that ordering. beeware#2686 (comment)
Thanks, the issues were resolved |
This all looks good to me, but even performance improvements should have a test where possible. Since the tests are run in alphabetical order, the
|
I'd be a little wary of adding a test that depends on execution order - while default invocation of pytest will execute in alphabetical order, there's no guarantee tests will be executed in that order (especially if they're manually specified). An explicit test that a widget such as Button has been imported correctly (whether by the test, or by running a Button test previously) is definitely called for - but I don't think the "from a clean state" requirement (i.e., that |
There should still be a test verifying that a clean import of The test itself could create the clean slate by removing |
True - although there's also the implementation cache of That said - looking at the current implementation, the value is being set in |
Every module object has its own
See "customizing module attribute access" – adding the value to |
Huh - my mental model has |
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.
🥳 🎉 thanks @mhsmith for completing my forgotten work |
adds a lazy import mechanism using a module-level getattr function. This applies to:
Only
PR Checklist: