From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#68559: [PATCH] Improve Python shell completion Date: Tue, 20 Feb 2024 14:15:49 +0100 Message-ID: <878r3fz37e.fsf@epfl.ch> References: <6BAFD8BF-8F18-4D9F-9DB3-A185AEF2EBCA@gmail.com> <867cj5wuo6.fsf@gnu.org> <865xypwu5e.fsf@gnu.org> <87il2kvbh5.fsf@epfl.ch> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35953"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , kobarity@gmail.com, mattias.engdegard@gmail.com, 68559@debbugs.gnu.org To: Liu Hui Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 20 14:17:31 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rcQ02-0008yo-4Y for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 20 Feb 2024 14:17:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcPzI-0007AR-Jx; Tue, 20 Feb 2024 08:16:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcPzF-0007A4-7D for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2024 08:16:42 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rcPzE-0007G3-V0 for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2024 08:16:40 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rcPza-0000UV-CH for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2024 08:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Feb 2024 13:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68559 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68559-submit@debbugs.gnu.org id=B68559.17084349821811 (code B ref 68559); Tue, 20 Feb 2024 13:17:02 +0000 Original-Received: (at 68559) by debbugs.gnu.org; 20 Feb 2024 13:16:22 +0000 Original-Received: from localhost ([127.0.0.1]:44501 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcPyv-0000T8-Up for submit@debbugs.gnu.org; Tue, 20 Feb 2024 08:16:22 -0500 Original-Received: from mail-lf1-f52.google.com ([209.85.167.52]:41300) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcPyt-0000Su-By for 68559@debbugs.gnu.org; Tue, 20 Feb 2024 08:16:20 -0500 Original-Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-5114a21176cso1273775e87.1 for <68559@debbugs.gnu.org>; Tue, 20 Feb 2024 05:15:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708434951; x=1709039751; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3KS0Zt6ru3n9DwY+jUBDeKg3+16HosDmikodnPtDpIA=; b=vKxeSrZoXaks/4bf4lsNLuCYcM9RWUfIfapMDIcbAvzJ5YMFlKez2kCoBOWd7niIJ4 7SfbWxHG/5n21w+HQO+B5YCIi+hwzAB1kJX0zOBSy9Rfg5aVOkreFUz9pekaxkFjHiV3 VqB/pnzPXSm4ycuFGAcuQ1ucbvdVBJv2j37lQzvp/CFhJpRltvF5VzkQe1rrp7xj4GnE jO+3sujICoR11yIB+51iu5su183AZFMPwGdMKw1Zy2TK/7B8cEUMvtmv5vin2YOS5gRW sbmDZ490zdSqU9/0X5/R6vxthQ8F4kJu/X+DZZ2ij3capomJbeAlznljRLeaAP47uB63 uCFQ== X-Forwarded-Encrypted: i=1; AJvYcCV3rg3KnkPvBjB1riqKuZ5NNUuOrlcaioqLyhQkm5CZxt3peqeLLeTkCtD7ez94GSHZkqdFFgCiPdhuLNz329a8HSc9R5o= X-Gm-Message-State: AOJu0YzrS9DisxTkKUdCyyp0NWNdRuHiROxBBT9B/iy5rly/NEO8fiJM EVdsmVgIQ3r5vq9JQatxg7OsZ4fiFvJdD7Z8kB+ecUQHscMRjiif X-Google-Smtp-Source: AGHT+IHi+fqEyk5BnpYaKhe7fQKXa48aR1Rprhd9AInnAm/Aj0TA1utkAbzOdE8zEj/b5hM5+ExtYg== X-Received: by 2002:a05:6512:4023:b0:512:adb7:7951 with SMTP id br35-20020a056512402300b00512adb77951mr4862189lfb.5.1708434950953; Tue, 20 Feb 2024 05:15:50 -0800 (PST) Original-Received: from localhost ([2001:620:618:5c0:2:80b3:0:85c]) by smtp.gmail.com with ESMTPSA id ps12-20020a170906bf4c00b00a3e2ba369d8sm3409564ejb.47.2024.02.20.05.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 05:15:50 -0800 (PST) In-Reply-To: (Liu Hui's message of "Tue, 20 Feb 2024 12:46:28 +0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280318 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Liu Hui [2024-02-20 12:46 +0800] wrote: > On Mon, Feb 19, 2024 at 9:18=E2=80=AFPM Basil L. Contovounesios > 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=3D/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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=prynt.diff 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) --=-=-= Content-Type: text/plain Running 'make TEST_LOAD_EL=no test/python-tests' now results in the following output file: --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=my-py-out-kFh7He.txt /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]: --=-=-= Content-Type: text/plain 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 --=-=-=--