Traitlets too old for Jupyter Server
Unfortunately, installing and enabling hide-code in a current version of Jupyter will cause Jupyter Server to crash because it requires an old version of traitlets:
Entered start.sh with args: jupyter lab
Executing the command: jupyter lab
Traceback (most recent call last):
File "/opt/conda/bin/jupyter-lab", line 6, in <module>
from jupyterlab.labapp import main
File "/opt/conda/lib/python3.9/site-packages/jupyterlab/labapp.py", line 13, in <module>
from jupyter_server.serverapp import flags
File "/opt/conda/lib/python3.9/site-packages/jupyter_server/serverapp.py", line 87, in <module>
from jupyter_server.services.sessions.sessionmanager import SessionManager
File "/opt/conda/lib/python3.9/site-packages/jupyter_server/services/sessions/sessionmanager.py", line 22, in <module>
from jupyter_server.traittypes import InstanceFromClasses
File "/opt/conda/lib/python3.9/site-packages/jupyter_server/traittypes.py", line 7, in <module>
from traitlets.utils.descriptions import describe
ModuleNotFoundError: No module named 'traitlets.utils.descriptions'
It will start if traitlets is force upgraded pip -U traitlets after installing hide_code, though it will throw this error:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
hide-code 0.6.0 requires traitlets<5.0, but you have traitlets 5.1.1 which is incompatible.
hide_code then is then successfully loaded, but I haven't tested everything from there:
[I 2022-03-28 18:30:56.733 ServerApp] hide_code: Attempting to load hid_code export handler extensions.
[I 2022-03-28 18:30:56.735 ServerApp] hide_code: Hide_code export handler extensions loaded.
[I 2022-03-28 18:30:56.735 ServerApp] hide_code | extension was successfully loaded.
So, for now, the workaround seem to be pip install -U traitlets after installing this plugin and before starting jupyter server and ignoring the pip warning. It seems updating the traitlets dependency version should be all this needs to make it compatible moving forward?
The workaround I mentioned above no longer works. It doesn't seem to be possible to install hide_code on a current version of Jupyter at all at the moment.
It looks like I was able to get it installed thanks to @fdion's fork: https://github.com/fdion/hide_code/tree/compatibility
pip install git+https://github.com/fdion/hide_code@compatibility
I have some time this summer to update hide_code. This package needs some serious housekeeping.