mwouts / jupytext

Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts
https://jupytext.readthedocs.io
MIT License
6.6k stars 386 forks source link

Incompatibility with jupyter_server 2.11.0 #1165

Open LoicGrobol opened 10 months ago

LoicGrobol commented 10 months ago

Description

jupyter_server version 2.11.0 broke JupytextContentsManager, making jupytext unusable.

Reproduce

  1. Install both jupytext and jupyter_server==2.11.0
  2. Start jupyterlab jupyter lab (the issue also occurs with notebook though)
  3. Open the interface in a browser
  4. The interface fails to load properly (e.g. no file list) and errors appear in the console, most notably

TypeError: build_jupytext_contents_manager_class.<locals>.JupytextContentsManager.get() got an unexpected keyword argument 'md5'

This is most likely caused by the API change in https://github.com/jupyter-server/jupyter_server/pull/1363 which made md5 part of the expected arguments to the contents managers get hook. A proper fix would be to update JupytextContentsManager accordingly, but in the meantime a hotfix would be to pin jupyter_server to <2.11.

daviehh commented 10 months ago

Might be a bit edge-case, but just limiting jupyter-server to <2.11 might not be enough since the script code generated by jupytext and the original ipynb file can get out of sync and throws an error

[W 2023-11-22 01:49:06.846 ServerApp] wrote error: 'test.ipynb (last modified 2023-11-22 05:03:33.603947+00:00) is more recent than test.py (last modified 2023-11-10 19:56:57.637370+00:00)\n\nDifferences
...
fcollonval commented 10 months ago

I opened an issue upstream - don't work yet to a fix because there is a high chance that version will get yanked...

mwouts commented 10 months ago

Thanks @LoicGrobol for the detailed report. Very helpful ! Thanks also @fcollonval for the update, I will wait for further news then.

Also right now we are in the middle of a big update so it might take me/us one week or more before we can release a fix.

Wh1isper commented 10 months ago

Sorry for the breaking changes to the API. I have created https://github.com/jupyter-server/jupyter_server/pull/1367 to fix this.

owenlamont commented 10 months ago

I saw jupyter-server 2.11.1 was released a few hours ago and I no longer get jupytext errors when launching Jupyter lab with it. This appears to be resolved.

fcollonval commented 10 months ago

Note for efficiency reasons, it will be nice to update the content manager to support the new hash introduced in https://github.com/jupyter-server/jupyter_server/pull/1367

mwouts commented 10 months ago

Note for efficiency reasons, it will be nice to update the content manager to support the new hash introduced in jupyter-server/jupyter_server#1367

Yes! Please leave this issue open, I will look into this. If I read the code correctly, the require_hash argument will return a hash for the file content on disk. With Jupytext documents, a notebook might correspond to multiple files, so all that I will need is probably to find a way to combine multiple hashes into one?

Also thanks for adding the downstream test against Jupytext! I have a quick question about that. We have a release candidate jupytext==1.16.0rc0. The packaging has changed a lot in that version (in particular the docs should be included now). Is it possible to run the downstream test just once against that pre-release version? (I could well fork jupyter_server and run the action on my fork, but I am not sure where to specify the --pre argument).

fcollonval commented 9 months ago

I don't think this is possible as I don't see an option in the action used: https://github.com/jupyterlab/maintainer-tools/blob/main/.github/actions/downstream-test/action.yml

You could open an issue there to see if it is possible.

mwouts commented 9 months ago

I don't think this is possible as I don't see an option in the action used: https://github.com/jupyterlab/maintainer-tools/blob/main/.github/actions/downstream-test/action.yml

Thanks for checking! No problem at all - I was just a little worried to break that test with the recent release of jupytext==1.16.0 but it went all fine!