bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#68559: [PATCH] Improve Python shell completion


From: Basil L. Contovounesios
Subject: bug#68559: [PATCH] Improve Python shell completion
Date: Tue, 20 Feb 2024 14:15:49 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Liu Hui [2024-02-20 12:46 +0800] wrote:

> On Mon, Feb 19, 2024 at 9:18 PM Basil L. Contovounesios
> <basil@contovou.net> wrote:
>>
>> BTW, I have been seeing an IPython test failure on GNU/Linux:
>> Any pointers?
>
> I cannot reproduce the problem with Python 3.12 and IPython 8.21. Can
> you check the results with the following steps? Thanks.

Thanks.  These all work as expected in 'emacs -Q', which made me realise
what may be the problem:

- the Emacs test suite runs under HOME=/nonexistent
- but PATH is unchanged
- I have the latest IPython installed locally using pipx:
  $ ls -l $(which ipython)
  lrwxrwxrwx 1 blc blc 53 Feb 20 11:46
    /home/blc/.local/bin/ipython ->
      /home/blc/.local/share/pipx/venvs/ipython/bin/ipython

This is confirmed by the following experiment:

diff --git a/test/lisp/progmodes/python-tests.el 
b/test/lisp/progmodes/python-tests.el
index af6c199b5bd..3393f93542b 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -4883,6 +4883,7 @@ python-shell-completion-at-point-ipython
     (python-tests-with-temp-buffer-with-shell
      ""
      (python-shell-with-shell-buffer
+       (make-temp-file "my-py-out-" nil ".txt" (buffer-string))
        (python-shell-completion-native-turn-off)
        (python-tests--completion-module)
        (python-tests--completion-parameters)
Running 'make TEST_LOAD_EL=no test/python-tests' now results in the
following output file:

/home/blc/.local/share/pipx/venvs/ipython/lib/python3.12/site-packages/IPython/paths.py:69:
 UserWarning: IPython parent '/nonexistent' is not a writable location, using a 
temp directory.
  warn("IPython parent '{0}' is not a writable location,"
Python 3.12.2 (main, Feb 18 2024, 16:59:56) [GCC 13.2.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.21.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: 
In this case list(get_ipython().Completer.completions(...)) is empty.

I'm not sure what the best way to detect or work around this is.
Any ideas?

[ It's a problem shared, to an extent, with Eglot tests, since LSP servers are
  often installed in one's HOME. ]

Thanks,
-- 
Basil

reply via email to

[Prev in Thread] Current Thread [Next in Thread]