Skip to content

Shell improvements#2895

Draft
DietmarSchwertberger wants to merge 11 commits into
wxWidgets:masterfrom
DietmarSchwertberger:SHELL_IMPROVEMENTS
Draft

Shell improvements#2895
DietmarSchwertberger wants to merge 11 commits into
wxWidgets:masterfrom
DietmarSchwertberger:SHELL_IMPROVEMENTS

Conversation

@DietmarSchwertberger
Copy link
Copy Markdown
Contributor

@DietmarSchwertberger DietmarSchwertberger commented May 16, 2026

This PR should improve wx.py.shell:

  • auto-completion on pressing tab
  • auto-completion on e.g. import
  • auto-completion on e.g. sys.path.a
  • automatic calltip on e.g. completion of sys.path.a to sys.path.append(
  • calltip also on class instantiation, not only on function calls
  • context menu entry "Copy History"

@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.

@RobinD42
Copy link
Copy Markdown
Member

This pull request has been mentioned on Discuss wxPython. There might be relevant details there:

https://discuss.wxpython.org/t/users-of-shell/40437/3

@newville
Copy link
Copy Markdown
Contributor

@DietmarSchwertberger Thanks for working on this.

On macOS with Python 3.13.13, I get

>>> 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.

@DietmarSchwertberger
Copy link
Copy Markdown
Contributor Author

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.

@DietmarSchwertberger
Copy link
Copy Markdown
Contributor Author

DietmarSchwertberger commented May 18, 2026

To be done:

  • handle cases like l[1].
  • handle .

update: they are ignored now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants