Closed lesteve closed 1 year ago
Thank you for opening an issue!
We should probably check if we're using the latest version of parso/jedi.
I think this is using the latest version of parso/jedi.
Inside the Jupyterlite from https://xeus-python-kernel.readthedocs.io/en/latest/,
import jedi; print(f"{jedi.__version__=}")
import parso; print(f"{parso.__version__=}")
jedi.__version__='0.18.1'
parso.__version__='0.8.3'
which match the latest versions from https://pypi.org/project/jedi/#history and https://pypi.org/project/parso/#history
For reference this still seems to be the case with the latest versions of jupyterlite-xeus-python
and jedi
/ parso
:
Just checked with the latest jedi 0.19 and there is still the same issue:
Using the https://xeus-python-kernel.readthedocs.io deployment I see completion working:
Although it's true that pr<tab>
does not show print as an option for some reason:
This is what I get with the following code snippet and pressing TAB:
import sys
sys.
https://github.com/jupyterlite/xeus-python-kernel/assets/591645/a9990b7c-1fdf-4b56-b638-1503cbd1d52a
I can't make sense of the behavior difference between classic xeus-python and jupyterlite-xeus-python as they both go through the same code path for the code completion.
One thing I thought about was that we may want to disable using jedi in the code completion in IPython. For pyodide-kernel it has been disabled in https://github.com/jupyterlite/pyodide-kernel/commit/e2e6819614ebe658a48abac4bcce8e66384da01b.
Yep, that seems to do the trick:
We can probably disable jedi in xeus-python by default. I would not be against this.
Also what does ipykernel
do to provide "nicer" completions out of the box compared to xeus python?
ipykernel
xeus-python
We're probably missing some metadata in the completion answer.
Indeed, when using jedi, ipykernel fills up some metadata:
And JupyterLab uses this information here https://github.com/jupyterlab/jupyterlab/blob/bddc378b72e8ee78be8b6e2ffb2b527a75f0471a/packages/completer/src/default/kernelprovider.ts#L61
We may want to explore implementing the same when not using Jedi. It might be possible, depending on what the IPython's Interactive Shell Completer gives us as information.
I can't make sense of the behavior difference between classic xeus-python and jupyterlite-xeus-python as they both go through the same code path for the code completion.
Could there also be a way to know why jedi
does not behave as expected with jupyterlite-xeus-python
?
Wondering if we could keep it enabled in the long run instead of disabling it that would help reduce the number of differences between "normal Jupyter" and JupyterLite.
To reproduce:
pr<TAB>
no completions is shownExpected behaviour: completions are shown showing
print
for exampleObserved behaviour: no completion is shown.
I originally observed the behaviour when using
jupyterlite build --XeusPython.packages
locallyI tried both in Firefox and Chromium, same behaviour.
Pyolite tab-completion seems to work fine e.g. on https://numpy.org/
Output from the browser console:
Here is a screenshot in case that helps