-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix Qtconsole autocomplete #112
base: main
Are you sure you want to change the base?
Conversation
Using See my output of pip freeze
|
For me it works this way, what is your pip freeze output? pip freezeargon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
arrow==1.2.3
asteval==0.9.28
asttokens==2.2.1
attrs==22.2.0
backcall==0.2.0
beautifulsoup4==4.11.1
bleach==6.0.0
cffi==1.15.1
colorama==0.4.6
comm==0.1.2
contourpy==1.0.7
cycler==0.11.0
debugpy==1.6.6
decorator==5.1.1
defusedxml==0.7.1
entrypoints==0.4
executing==1.2.0
fastjsonschema==2.16.2
finufft==2.1.0
fonttools==4.38.0
fqdn==1.5.1
future==0.18.3
fysom==2.1.6
gitdb==4.0.10
GitPython==3.1.30
idna==3.4
importlib-metadata==6.0.0
ipykernel==6.21.0
ipympl==0.9.3
ipython==8.9.0
ipython-genutils==0.2.0
ipywidgets==8.0.4
isoduration==20.11.0
jedi==0.18.2
Jinja2==3.1.2
jsonpointer==2.3
jsonschema==4.17.3
jupyter==1.0.0
jupyter-console==6.4.4
jupyter-events==0.6.3
jupyter_client==8.0.2
jupyter_core==5.2.0
jupyter_server==2.1.0
jupyter_server_terminals==0.4.4
jupyterlab-pygments==0.2.2
jupyterlab-widgets==3.0.5
jupyterthemes==0.20.0
jupytext==1.14.4
kiwisolver==1.4.4
lesscpy==0.15.1
lmfit==1.1.0
lxml==4.9.2
markdown-it-py==2.1.0
MarkupSafe==2.1.2
matplotlib==3.6.3
matplotlib-inline==0.1.6
mdit-py-plugins==0.3.3
mdurl==0.1.2
mistune==2.0.4
mpmath==1.3.0
nbclassic==0.5.1
nbclient==0.7.2
nbconvert==7.2.9
nbformat==5.7.3
nest-asyncio==1.5.6
nidaqmx==0.6.5
notebook==6.5.2
notebook_shim==0.2.2
numpy==1.24.1
packaging==23.0
pandocfilters==1.5.0
parso==0.8.3
pickleshare==0.7.5
Pillow==9.4.0
platformdirs==2.6.2
plumbum==1.8.1
ply==3.11
prometheus-client==0.16.0
prompt-toolkit==3.0.36
protobuf==4.21.12
psutil==5.9.4
pure-eval==0.2.2
pycparser==2.21
Pygments==2.14.0
pyparsing==3.0.9
pyqtgraph==0.13.1
pyrsistent==0.19.3
PySide2==5.15.2
PySide6_Addons==6.7.2
PySide6_Essentials==6.7.2
python-dateutil==2.8.2
python-json-logger==2.0.4
PyVISA==1.13.0
pywin32==305
pywinpty==2.0.10
PyYAML==6.0
pyzmq==25.0.0
qtconsole==5.4.0
QtPy==2.3.0
-e git+https://github.com/Ulm-IQO/qudi-core.git@53a86e4d217b4ae72d3cfaa54dc8b8c07e227913#egg=qudi_core
-e git+https://github.com/Ulm-IQO/qudi-iqo-modules.git@3039e05d4e1599417a74da7dae6dc61979c7eed1#egg=qudi_iqo_modules
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rpyc==5.3.1
ruamel.yaml==0.17.21
ruamel.yaml.clib==0.2.7
Rx==3.2.0
scipy==1.10.0
Send2Trash==1.8.0
shiboken2==5.15.2
shiboken6==6.7.2
six==1.16.0
smmap==5.0.0
sniffio==1.3.0
soupsieve==2.3.2.post1
stack-data==0.6.2
sympy==1.12
terminado==0.17.1
tinycss2==1.2.1
toml==0.10.2
tornado==6.2
traitlets==5.9.0
typing_extensions==4.4.0
uncertainties==3.1.7
uri-template==1.2.0
wcwidth==0.2.6
webcolors==1.12
webencodings==0.5.1
websocket-client==1.5.0
widgetsnbextension==4.0.5
zaber-motion==2.15.4
zaber-motion-bindings-windows==2.15.4
zipp==3.12.0```
</details> |
I just reinstalled from scratch:
The difference between both pip freezes is
according to chatgpt. Details
I just saw your pip freeze and will check with yours. |
I put your pip freeze into a requirements.txt, removed the qudi-core specifier, to keep my currently checked out commit and did Chatgpt says the difference between our freeze is (Before being my current freeze, after is yours)
After:
is this pip freeze the working or the not working commit as you are with this commit on current main. |
Well since this PR does not change the package requirements for |
Ah now I see. I did not try
So I assumed that these flags were set correctly, but maybe it is something similar like the ipython kernel config that it is not correctly applied. |
I mean you can access those attributes by typing instead of tabbing, so it does not seem to be an issue with |
My latest commit fixes the issue. In debug mode one can see that Jedi crashes when trying to evaluate the netref objects. Something has changed in rpyc 6.0.0 that makes jedi no longer work with them and the error message is not very helpful. Turning jedi off and changing the suppose we want to examine the list of modules that are loaded by the configuration file. |
Nice. The second part is a well known issue between IPython and rpyc and one of the reasons I tried to restrict code execution during auto-completion. But nice to see that version 6 seems to fix that to some extent. Maybe we should think about setting this version as minimum requirement to reduce compatibility problems. |
Should I include this requirement in |
I checked Issue #114 and noticed upon experimenting that autocompletion for importing qudi modules (e.g. Furthermore, autocompletion for a remote module also does no longer work. While the first error gives some error (in autocompletion debug mode) when trying to type |
Description
This PR fixes a bug, where the QtConsole and Jupyter-Notebook completer is not working, except for top-level namespace objects such as the individual modules for rpyc==6.0.0. This makes typing in QtConsole
qudi.<Tab>
possible again (or in jupyter-notebook).Motivation and Context
When starting qudi, QtConsole connects to the local-namespace-server. This rpyc service has the
exposed_get_namespace_dict
method that returns a dict of all loaded modules. This should make it possible for the qtconsole to autocomplete the loaded modules and their attributes. For rpyc<6.0.0 this works, one can press to autocomplete e.g.qudi
upon startup. Typingqudi.<Tab>
also autocompletes by giving the list for all attributes ofqudi
.With rpyc 6.0.0 this no longer works. I found out that this was caused by the
QudiIPythonKernel.shell.Completer.use_jedi
variable. When checking theQudiIPythonKernel
class one can see in the__init__
that this has caused some issues in the past and has been fixed already. In fact one can check the config during runtime by typingget_ipython().Completer.config
in QtConsole. The use_jedi variable is set toFalse
. However, when checking the runtime parameters of the Completer by typingget_ipython().Completer.use_jedi
it is still set toTrue
. In rpyc 5.3.1 it seems to work with use_jedi=True.Installing rpyc 6.0.0 shows the same output of both commands, however autocomplete is only working for the top level modules as e.g.
q<Tab>
which can complete toqudi
, butqudi.<Tab>
does not show any results. When settingget_ipython().Completer.use_jedi = False
, autocompletion works as before. This PR sets this variable directly during init of the Kernel. As the comment in the code above my changes suggests, this is not properly documented how to change the config properly for embedded IPython. Maybe we have to work with a properly set up individual IPython profile or using thetraitlets
module. However, I didn't get it to work quickly so I decided to again go for this workaround.How Has This Been Tested?
Testing autocomplete in jupyter-notebook and qtconsole with rpyc 5.3.1 and 6.0.0 installed.
Types of changes
Checklist:
/docs/changelog.md
.(syntax, indentation, mutable default values, etc.).