[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Completion in python mode + IPython
From: |
Ergus |
Subject: |
Re: Completion in python mode + IPython |
Date: |
Mon, 13 Jan 2025 22:05:55 +0100 |
Hi Liu:
I totally understand the point.
What's surprising me is that the non-default option works much better
than the default one for users with IPython. I thing that one of the may
reasons to choose ipython as REPL is the IPython completion indeed.
I already the links you share and sincerely the jedi completion is
still way worst than the IPython one.
So, for the moment I will just disable the native completion and rely in
the legacy one.
Best,
Jimmy
On Mon, Jan 13, 2025 at 05:36:23PM +0800, Liu Hui wrote:
>On Sun, Jan 12, 2025 at 2:01 AM Ergus <spacibba@aol.com> wrote:
>>
>> Hi all:
>>
>> Recently I have been using python mode and I noticed that the
>> completions in the python shells are too basic.
>>
>> For interactive shells IPython offers a more friendly completion set and
>> it used to work in the past with emacs just with
>>
>> ```
>> python-shell-interpreter "ipython"
>> python-shell-interpreter-args "--simple-prompt"
>> ```
>>
>> I found that the issue is that the default value:
>>
>> python-shell-completion-native-enable t
>>
>> Uses only the basic readline completions, while Ipython uses a different
>> very improved api.
>>
>> The commit 0b9c7148fd681c8ad63fd0eb3895d from Liu Hui (Jan 28, 2024)
>>
>> Solves this issue for the `python-shell-completion-setup-code` (the
>> non-default one).
>>
>> As python-mode is supposed to support ipython, why we don't include the
>> same in `python-shell-completion-native-setup`.
>>
>> Is this intended?
>
>Hi,
>
>It is possible to improve __PYTHON_EL_Completer to support IPython by
>default, and my first few patches in bug#68559 included an IPython
>readline completer too. The reasons for keeping the simple completer
>wrapper in `python-shell-completion-native-setup` are as follows:
>
>1. It is better not to add more python snippets as strings in elisp
>files, which is not easy to maintain.
>
>2. It is more flexible to put custom python completer in
>PYTHONSTARTUP. Then Python REPL can have better and consistent
>completion in various shells including Emacs. You can find examples in
>https://jedi.readthedocs.io/en/latest/docs/usage.html#repl-completion
>and #68559.
>
>
>Best,
>Hui
>