[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Completion in python mode + IPython
From: |
Liu Hui |
Subject: |
Re: Completion in python mode + IPython |
Date: |
Mon, 13 Jan 2025 17:36:23 +0800 |
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