Skip to content
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

odd behaviour of the jupyterlab extension: the notebook toolbar is sometimes missing #1107

Closed
parmentelat opened this issue Jul 20, 2023 · 8 comments

Comments

@parmentelat
Copy link
Contributor

parmentelat commented Jul 20, 2023

this is a followup on #1092

As planned I have made manual tests of the tentative jupyterlab extension as packaged in version
1.15.0.dev1

test env

create a fresh conda env

conda create -y -n nb7-text python=3.11
conda activate nb7-text
pip install notebook; pip install --pre jupytext

as of today this gives me

pip freeze | egrep 'notebook|jupyte'
jupyter-events==0.6.3
jupyter-lsp==2.2.0
jupyter_client==8.3.0
jupyter_core==5.3.1
jupyter_server==2.7.0
jupyter_server_terminals==0.4.4
jupyterlab==4.0.3
jupyterlab-pygments==0.2.2
jupyterlab_server==2.23.0
jupytext==1.15.0.dev1
notebook==7.0.0
notebook_shim==0.2.3

test scenario

I have 2 notebooks with identical contents, one in ipynb and one in py:percent format

  • open them both under notebook
  • open them both under jlab (jupyterlab gets installed implicitly as a dependency of notebook as of nb7)

observations

as of today, I have observed that in both notebook and jupyterlab, the jupytext format leads to a UI with a missing toolbar (see pictures below)

notebook

jupytext-notebook-OK-ipynb

but

jupytext-notebook-KO-py

jupyterlab

same symptom, more or less

jupytext-lab

troubleshooting

in both cases I see these messages that I do not like at all:

notebook

jupytext-notebook-KO-py-console-warnings

jlab

jupytext-lab-console-warnings

EDIT

conjecture

the following conjecture has been proven false - see below

I am starting to wonder if that idea of shipping a single extension for both jlab3 and jlab4 has any chance to fly; it feels like the extension, as compiled under jlab3, has pinned versions of some modules, but that these modules are loaded under another version number, and the loader refuses to load several instances (that's what singleton suggests. right?)

it's ironic because the missing area is not something that jupytext tampers with at all; I wonder why these modules are even needed ?

@parmentelat
Copy link
Contributor Author

parmentelat commented Jul 24, 2023

focusing on jlab from now on, there's nothing specific to nb7 in our findings

it appears that in this code
https://github.com/mwouts/jupytext/blob/main/packages/labextension/src/index.ts#L510

the value of notebookFactory.toolbarFactory is undefined when we pass it to the constructor of NotebookWidgetFactory

and I suspect this might very well be the root cause for the faulty behaviour

not quite sure why this is, possibly notebookFactory is not fully initialised at that point in time ?

investigation to be continued ...

@parmentelat
Copy link
Contributor Author

in any case I think I have been able to rule out my first conjecture (that building for jlab3 and jlab4 from the same code was the culprit); to that end I have

  • rebuilt jupytext without the jlab extension
  • rebuilt jupyterlab-jupytext under jlab4
  • run all this under jlab4, and the result is still the faulty behaviour

@parmentelat
Copy link
Contributor Author

one other thing:

  • scenario 1:

    • running jupyter lab from the terminal within an empty workspace
    • opening a jupytext notebook from the file browser
    • results in the faulty behaviour
  • scenario 2:

    • from the situation of scenario 1, exit cleanly - i.e. make so that the jupytext notebook is opened in the workspace
    • restart jupyter lab; the jupytext notebook opens "on it own"
    • and in that setup, the toolbar appears just fine

I have instrumented the value of notebookFactory.toolbarFactory just before https://github.com/mwouts/jupytext/blob/main/packages/labextension/src/index.ts#L497

in both cases, notebookFactory.toolbarFactory is undefined
(and indeed commenting off the toolbarFactory field in the options passed to the NotebookWidgetFactory constructor gives exactly the same result)

I need to find out more about the internals of jlab, and for starters I need to be able to build it locally

to be continued...

@parmentelat parmentelat changed the title odd behaviour of the jupyterlab extension: the notebook toolbar is missing odd behaviour of the jupyterlab extension: the notebook toolbar is sometimes missing Jul 25, 2023
@parmentelat
Copy link
Contributor Author

@mwouts
Copy link
Owner

mwouts commented Jul 28, 2023

Thank you @parmentelat for reporting and investigating this! FYI I had seen a similar report by @jtpio in this comment, so it's great news that you already have a PR ready to address this. I'm going to merge it and release a new dev version.

mwouts pushed a commit that referenced this issue Jul 28, 2023
* the beginning of a fix for #1107

indeed with jlab4 we need to duplicate the code that creates the notebook toolbar
this version is much nicer already, but still builds an incomplete toolbar

* using the right config solves #1107

* minor cleanup
@parmentelat
Copy link
Contributor Author

hi @mwouts

I've been using the dev release for a couple weeks now - exclusively under jlab4+nb7 - and apart from this issue, which is now fixed in dev2, I have seen no showstopper

So I would even go as far as suggesting to issue a plain release with this; rationale being that people using just jupyterlab + jupytext as their requirements are currently left out to dry...

It seems to me that:
. dev2 is much better than 1.14 for people under jlab4
. dev2 should work just the same for people under jlab3

actually I had manually tested dev1+jlab3, it would make sense to do that again with dev2 (even though again it should be the same code exactly)

once this is done I would move for a release of that code, if you agree

@parmentelat
Copy link
Contributor Author

also I was thinking, on a totally different plane, that it could help to set jupyterlab-jupytext as archived wrt github, after having edited the README to say that the extension is currently part of and packaged with the jupytext repo; this had me a bit by surprise at first :)

@mwouts
Copy link
Owner

mwouts commented Jul 30, 2023

Sure ! Thank you @parmentelat for doing the testing. I have archived the jupyterlab-jupytext repository as suggested, and I will soon release jupytext==1.15.0.

@mwouts mwouts closed this as completed Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants