GNU bug report logs - #68559
[PATCH] Improve Python shell completion

Previous Next

Package: emacs;

Reported by: Liu Hui <liuhui1610 <at> gmail.com>

Date: Thu, 18 Jan 2024 04:50:01 UTC

Severity: wishlist

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #170 received at 68559 <at> debbugs.gnu.org (full text, mbox):

From: Liu Hui <liuhui1610 <at> gmail.com>
To: "Basil L. Contovounesios" <basil <at> contovou.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, kobarity <at> gmail.com,
 mattias.engdegard <at> gmail.com, 68559 <at> debbugs.gnu.org
Subject: Re: bug#68559: [PATCH] Improve Python shell completion
Date: Fri, 23 Feb 2024 21:07:22 +0800
On Thu, Feb 22, 2024 at 9:56 PM Basil L. Contovounesios
<basil <at> contovou.net> wrote:
>
> Liu Hui [2024-02-22 18:31 +0800] wrote:
>
> > On Wed, Feb 21, 2024 at 10:55 PM Basil L. Contovounesios
> > <basil <at> contovou.net> wrote:
> >>
> >> Liu Hui [2024-02-21 18:00 +0800] wrote:
> >>
> >> > The attached patch should fix the problem.
> >>
> >> Thanks!  The patch fixes the error, but that's because
> >> python-shell-completion-at-point-ipython is now skipped:
> >
> > Only the native completion part is skipped for the reason below.
> >
> >> in particular, python-shell-readline-completer-delims evaluates to
> >> "\s\t\n`~!@#$%^&*()-=+[{]}\\|;:'\",<>/?" rather than the empty string.
> >
> > "\s\t\n`..." is the delimiter used by rlcompleter, which is the
> > default completer used by the readline. rlcompleter cannot complete
> > module names or parameters, so in this case the native completion part
> > is skipped.
> >
> > The test is intended to be used with Jedi as the completion backend,
> > e.g. setting PYTHONSTARTUP="$(python -m jedi repl)", or with a custom
> > IPython completer defined in the PYTHONSTARTUP file. I have updated the
> > patch to make the test use Jedi when possible.
>
> Thanks, looks fine to me and runs without issue.
>
> The python-shell-completion-at-point-ipython test is still skipped, with
> or without specifying PYTHONSTARTUP="$(python -m jedi repl)", but like
> you suggest that's not necessarily a problem.

I have no idea why the test is skipped. You may still check if native
completion works for IPython with following steps:

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

2. start Python shell with IPython interpreter, i.e.
   (setq python-shell-interpreter "ipython")
   (setq python-shell-interpreter-args "-i --simple-prompt")
   M-x run-python

   There should be text "REPL completion using Jedi xxx" before the
   first prompt in the Python shell buffer, and a message "Shell
   native completion is enabled.".

3. type "import ab"/"open(enc" and press TAB

   expected result: "import abc"/"open(encoding="

> I'm guessing you don't have write access to emacs.git, but have signed
> the CA?  If so, and if there are no other comments/objections in a few
> days, I'll apply the patch in your name.

Yes, I've signed the CA. Thanks.

> Is your GitHub username ilupin by any chance?
>
> I ask because there is one commit in emacs.git from someone with the
> same name as you, but with the email address
> ilupin <at> users.noreply.github.com (I'm guessing the commit was imported
> from eglot.git).
>
> If that was from you, do you have any objection to me mapping
> ilupin <at> users.noreply.github.com to liuhui1610 <at> gmail.com in the .mailmap
> file in emacs.git?  Then all commits will show up under a single name
> and email address.

Yes. I have no objection, thanks.




This bug report was last modified 1 year and 66 days ago.

Previous Next


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