Pull out wx to top level import, improve typing for core#13701
Pull out wx to top level import, improve typing for core#13701seanbudd wants to merge 4 commits into
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
See test results for failed build of commit 1bff20152c |
|
How you've determined that not importing |
I've run the launcher and run from source. I'd be incredibly surprised if it wasn't safe. Our main reason for deferred imports is circular dependencies. |
|
Another reason for deferred imports is one dependency may need another dependency initialized first. |
|
Another thing to consider here, where some other module needs to import core before wx is imported. A reason for this may be the time it takes to import wx. |
|
running from source, with the following code at the start of core.py """NVDA core"""
import time
s = time.time()
import wx
print(time.time()-s)Time spent importing: |
|
This is an increase to the sum of the other imports: 0.00799 |
|
Will it also be considered to improve the code style of core, i.e. by taking the class definitions of App, CorePump and MessageWindow out of the main function? |
I believe imports are cached, and wx must be imported in For the python console, this is already imported in the namespace: https://www.nvaccess.org/files/nvda/documentation/developerGuide.html#toc47 |
|
Way back in NVDA's infancy, we did deliberately import wx after
initializing speech, so that on slow machines or when running off a USB
key, we could speak a message first, as loading wx would add up to 10
seconds of time back then.
But I really don't think this is relevant anymore, and no doubt we
already broke this rule a long time back.
|
This comment was marked as resolved.
This comment was marked as resolved.
When NVDA starts, multiple NVDA processes are triggered (due to the way we use Ease of Access), this is unrelated, probably unwanted behavior. However, in those cases, NVDA quite quickly determines that another NVDA process is already running, then exits. Moving the import of
Sorry, I don't follow this. |
|
Another approach can be started to add typing to core, without moving the |
Link to issue number:
Follow up of #13699
Summary of the issue:
NVDA core is dependent on wx in many implicit cases.
Description of how this pull request fixes the issue:
Make the wx dependency explicit.
Add additional linting and typing for work done in #13699.
Future work is needed to make core no longer dependent on wx.
Testing strategy:
Test starting NVDA with a built launcher and running from source
Known issues with pull request:
Change log entries:
No user facing changes
Code Review Checklist: