infrastructure: Jupytext now fails to open .Rmd in classic notebook

Context

Ref: https://2i2c.freshdesk.com/a/tickets/459

There was a preliminary investigation from @yuvipanda and then @damianavila spent a few cycles concurring and pointing to a problem in the image itself because of being able to locally reproduce the issue.

Mathew brought new evidence suggesting it might be something on our side as well (our configuration of the hub).

Proposal

I think we need to do another round of investigation given the latest data provided by Matthew.

Updates and actions

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

My conclusions after debugging this

1. JupyterLab

On JupyterLab, the solution described in https://github.com/2i2c-org/infrastructure/issues/2302#issuecomment-1471805215 as a workaround is not actually a workaround, but the solution and how the Jupytext itself documents it to be configured in a lab environment, for newest jupyterlab versions.

So, JupyterLab + Jupytext in the current 2i2c hub environment works as expected if configured per the Jupytext documentation.

2. Classical Notebook interface

My conclusion is that Jupytext is not currently fully compatible with the current 2i2c hub environment, nor with latest mybinder deployment. At least not out of the box, or not without some tweaking in jupytext, or adjacent notebook and nbclassic projects.

For example, the example in the Jupytext’s documentation itself doesn’t work on the classical notebook interface and manifests the same behaviour. Check it out by expanding the first bullet in https://jupytext.readthedocs.io/en/latest/index.html#install and then click on the mybinder link.

A more in-depth study

What it happens when clicking on an .md file from the classical notebook is that the link that gets generated is set correctly by Jupytext to something like _https://staging.2i2c.cloud/user/../notebooks/hello.md_, but then it gets a 301 and permanently redirected to _https://staging.2i2c.cloud/user/.../files/hello.md_, (notice notebooks vs file in the URL) hence the different behaviour in different browsers. Some, render the file in browser, some promt you to download the file.

My best guess is that this is coming from nbclassic’s default behaviour that somehow Jupytext is unable to overwrite.

I believe this is also related somehow to the changes that migrating mybinder and the 2i2c hubs to use ServerApp instead of NotebookApp. Probably because these changes are the ones that impose the use nbclassic for the classical notebook interface. Unfotunatelly I wasn’t able to ‘fix’ the issue by just reverting the changes there. Maybe I missed something. But going back to NotebookApp should not be the recommended way forward anyway since everything moves the the ServerAPpps’ direction.

What to do next

Given that this incompatibility is already captured in the relevant upstream projects:

LIS hub

I believe JupyterLab can be used instead of the classical notebook, with Jupytext, now that we concluded that they work ok toghether on the current hub setup, until the upstream issues get resolved.

Great - and thanks for all your work on this.