zxcalc / pyzx

Python library for quantum circuit rewriting and optimisation using the ZX-calculus
Apache License 2.0
388 stars 116 forks source link

Make ZX diagram editor compatible with newer version of ipywidgets #268

Closed rafaelha closed 3 months ago

rafaelha commented 3 months ago

The ZX diagram editor only works with older version of jupyter notebook and ipywidgets. From the docs:

The newer JupyterLab as opposed to the older Jupyter Notebook uses a different framework for widgets which is
currently not compatible with the widgets used in PyZX. For the editor to work you therefore must use the classic
notebook interface. If you are using JupyterLab you can find this interface by going to 
‘Help -> Launch Classic Notebook’. 
In addition, versions ipywidgets>=8 and notebook>=6.5 break the editor widget. 
The latest versions known to work is ipywidgets==7.7.1 and notebook==6.4.12.

Can newer version be supported? What is required to get the editor to work?

jvdwetering commented 3 months ago

Jupyterlab uses a completely different widget system, where you have to make a separate package of that widget and install it. I didn't look into the details, but it looked really complicated and would possibly require a lot of rewriting. Seeing as the current version already required a lot of hacking to get the python backend and the javascript front-end to talk to each, I have no plans to do so, also considering that a much better editor now exists in the form of ZXLive, which can also be run from a Jupyter notebook and interfaces with PyZX.