You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>> import wx.py as py
...
File "..../lib/python3.13/site-packages/wx/py/shell.py", line 28, in <module>
from _pyrepl import _module_completer
ImportError: cannot import name '_module_completer' from '_pyrepl' (/.../lib/python3.13/_pyrepl/__init__.py)
Sorry, I haven't been able to investigate further.
Thanks. It seems _pyrepl is available on 3.13, but not _module_completer.
I have modified to check for ModuleNotFoundError and also ImportError.
The full autocompletion including imports is therefore only available on 3.14.
Thank you for working on this PR @DietmarSchwertberger.
I would like to leave some comments.
auto-completion on pressing tab
Using the Tab key to trigger completion is natural and consistent with the standard PyREPL behavior.
auto-completion on e.g. import
Nice. It would also be nice if from x import y statements were supported.
auto-completion on e.g. sys.path.a
When a . and the a key is pressed, auto-completion is invoked. Do you have more ideas for improving this behavior?
automatic calltip on e.g. completion of sys.path.a to sys.path.append(
I think using an icon instead of ( to indicate callables is more natural and visually intuitive.
The stc.StyledTextCtrl completion function has functionality to set icons for each completion item.
calltip also on class instantiation, not only on function calls
context menu entry "Copy History"
These seem good. Maybe a separate PR would be better.
I tested it with Python 3.13.14 and wxPython 4.3.1 msw (Phoenix) with wxWidgets 3.3.3. However, module completion does not work well.
I guess _pyrepl has changed since this PR was created, and _pyrepl._module_completer has been removed. So, relying on a private module may cause compatibility issues in the future. Never mind. You already mentioned it above. I’ll install Python 3.14 and test it later.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR should improve wx.py.shell:
importsys.path.asys.path.atosys.path.append(@newville , @komoto48g : would you mind testing?
I started this when I saw the new, improved shell features of the recent Python versions. I was hoping there was a bit more abstraction...
P.S.: I'm testing / developing this on Python 3.12 and 3.14. I think that I'm not using recent features, but need to test.