Ipython autocomplete not working

Hi,

I’m trying to get IPYTHON auto completion to work on macOS 15.1.
Current version of the toolchain:

$jupyter --version
Selected Jupyter core packages...
IPython          : 8.29.0
ipykernel        : 6.29.5
ipywidgets       : 8.1.5
jupyter_client   : 8.6.3
jupyter_core     : 5.7.2
jupyter_server   : 2.14.2
jupyterlab       : 4.2.5
/Library/Frameworks/Python.framework/Versions/3.13/bin/jupyter:8: DeprecationWarning: Parsing dates involving a day of month without a year specified is ambiguious
and fails to parse leap day. The default behavior will change in Python 3.15
to either always raise an exception or to use a different default year (TBD).
To avoid trouble, add a specific year to the input & format.
See https://github.com/python/cpython/issues/70647.
  sys.exit(main())
nbclient         : 0.10.0
nbconvert        : 7.16.4
nbformat         : 5.10.4
notebook         : 7.2.2
qtconsole        : not installed
traitlets        : 5.14.3

Originally, autocompletion (from within an interactive ipython console session) - wouldn’t work for objects. If I have an object obj, typing "obj.<tab>" wouldn’t show completion options. Googling, I figured that this is due to jedi. So I uninstall jedi. I try again, this time object autocompletion works. Great.

But another problem occurs: Autocompletion doesn’t work when I trying to import modules, when those modules are in my PYTHONPATH. If have a module lets say ‘mymodule’, when I type 'import my<tab>' it doesn’t seem to show the completion option. However, if I manually type in the whole thing ‘import mymodule’ - the import succeeds. So clearly it is not a PYTHONPATH issue. It is just the autocomplete. Note: This happens only for modules in my PYTHONPATH. The autocomplete works correctly for modules that come with python by default.

I install Jedi again. Now the autocompletion for the import works correctly, but not for objects!

In my mac, pyreadline and jedi versions are: pyreadline-2.1, jedi-0.19.2

So with Jedi, I get autocomplete for “custom” imports, but not for objects. But then without jedi, I get autocomplete for objects but not for “custom” imports.

How can I get them both to work correctly?
I’ve tried downgrading version for jedi, installing pyreadline etc. Nothing seems to work.

Thanks!

Basically IPython has two completer implementations:

  • (a) using jedi
  • (b) using custom guarded evaluation

We have full control over (b) and are on good terms with maintainers of jedi for improvements in (a) - but cannot guarantee that improvements in jedi will be merged. The way to get your problem in (b) solved is generally to open an issue on IPython issue tracker: GitHub - ipython/ipython: Official repository for IPython itself. Other repos in the IPython organization contain things like the website, documentation builds, etc. and ideally help with a PR (either submit it yourself with help of community or get someone to do it for you).

A good first step is to precisely explain how to reproduce your issue with import suggestions not showing up in the issue on IPython. If you ping me I can then link relevant code sections in the issue :slight_smile: