GNU bug report logs - #76205
31.0.50; 31.0.50; python.el completion broken for non-builtin objects in IPython 8.30.0 & Python 3.13.2

Previous Next

Package: emacs;

Reported by: Visuwesh <visuweshm <at> gmail.com>

Date: Tue, 11 Feb 2025 15:08:01 UTC

Severity: normal

Found in version 31.0.50

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: kobarity <kobarity <at> gmail.com>
To: Visuwesh <visuweshm <at> gmail.com>, liuhui1610 <at> gmail.com
Cc: 76205 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: bug#76205: 31.0.50; 31.0.50; python.el completion broken for non-builtin objects in IPython 8.30.0 & Python 3.13.2
Date: Thu, 13 Feb 2025 23:59:50 +0900
Visuwesh wrote:
> 
> [வியாழன் பிப்ரவரி 13, 2025] Liu Hui wrote:
> 
> > On Wed, Feb 12, 2025 at 11:03 PM kobarity <kobarity <at> gmail.com> wrote:
> >>
> >> Eli Zaretskii wrote:
> >> >
> >> > > From: Visuwesh <visuweshm <at> gmail.com>
> >> > > Date: Tue, 11 Feb 2025 20:37:22 +0530
> >> > >
> >> > > I am unsure if this is a me problem but I can no longer complete
> >> > > non-builtin objects in a python-mode buffer when I'm using the specified
> >> > > IPython&Python version combination.  However, if I don't use IPython,
> >> > > then completion does work as expected.  It prints the following message
> >> > > though (not sure if it is related):
> >> > >
> >> > >     Python 3.13.2 (main, Feb  5 2025, 01:23:35) [GCC 14.2.0] on linux
> >> > >     Type "help", "copyright", "credits" or "license" for more information.
> >> > >     warning: can't use pyrepl: terminal doesn't have the required clear capability; TERM=dumb
> >> > >     >>>
> >> > >
> >> > > To reproduce the issue,
> >> > >
> >> > >     1. emacs -Q
> >> > >     2. Open a python buffer.
> >> > >     3. Type in "import numpy as np" in the buffer.
> >> > >     4. Say C-u C-c C-p, answer ipython3 --simple-prompt -i to the first
> >> > >        prompt, then say no to the second.
> >> > >     5. After the *Python* is created, say C-c C-c in the python-mode
> >> > >        buffer.
> >> > >     6. Now type "np." and say M-TAB.
> >> > >     7. Observe how no completion candidates are offered.
> >> > >     8. Remove "np." and instead type "pr" and say M-TAB.
> >> > >     9. Observe how two completion candidates (print and property) are
> >> > >        offered.
> >> > >     10. Repeat the same without using IPython and observe how
> >> > >         python-mode offers completion after "np."
> >> > >
> >> > > I am on Debian sid with an "apt update && apt upgrade" today some 15
> >> > > mins ago (no luck after updating if I wasn't clear enough) if it
> >> > > matters.
> >> >
> >> > Thanks.
> >> >
> >> > kobarity, any comments or suggestions?
> >>
> >> I reproduced the issue with IPython 8.32.0 and Python 3.13.2.  It
> >> seems that there is no problem with IPython on Python 3.12.
> >>
> >> One workaround is to disable native completion:
> >> M-x python-shell-completion-native-turn-off
> >> It will be a little more inconvenient than the native completion.
> 
> Thank you very much, this works good enough for my needs.  I can work in
> peace now.

Then you might want to customize
`python-shell-completion-native-enable' or
`python-shell-completion-native-disabled-interpreters'.

> > The problem seems to be not related to emacs, because the completion
> > of non-builtin objects doesn't work in terminal too (IPython 8.32.0
> > and Python 3.13.2):
> >
> > 1. run ipython in a terminal: ipython3 --simple-prompt -i
> >
> > 2. type the following code:
> >    import readline
> >    import rlcompleter
> >    readline.parse_and_bind("tab: complete")
> >    import numpy as np
> >
> > 3. type np.<TAB>, there is no completion
> >
> >
> > If I change the completer to others (e.g. jedi):
> >    from jedi.utils import setup_readline
> >    setup_readline()
> >
> > then the completion works in both terminal and emacs.

Thanks for pointing this out.  So I confirmed that the following
workaround is also effective.

PYTHONSTARTUP="$(python -m jedi repl)" emacs -nw -Q




This bug report was last modified 89 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.