mwouts / jupytext

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

Build lab extension in jlab4 environment #1116

Closed moetayuko closed 11 months ago

moetayuko commented 1 year ago

lab extension fails to build when jlab4 installed:

Building extension in .
/usr/lib/python3.11/site-packages/jupyterlab/debuglog.py:56: UserWarning: An error occurred.
  warnings.warn("An error occurred.")
/usr/lib/python3.11/site-packages/jupyterlab/debuglog.py:57: UserWarning: ValueError: Extensions require a devDependency on @jupyterlab/builder@^4.0.4, you have a dependency on 3.5.0
  warnings.warn(msg[-1].strip())
/usr/lib/python3.11/site-packages/jupyterlab/debuglog.py:58: UserWarning: See the log file for details: /tmp/jupyterlab-debug-fvcrd9_1.log
  warnings.warn(f"See the log file for details: {log_path!s}")

in which the contents of the log file are:

Building extension in .
Traceback (most recent call last):

  File "/usr/lib/python3.11/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

  File "/usr/lib/python3.11/site-packages/jupyterlab/labextensions.py", line 155, in start
    ans = self.run_task()
          ^^^^^^^^^^^^^^^

  File "/usr/lib/python3.11/site-packages/jupyterlab/labextensions.py", line 279, in run_task
    build_labextension(

  File "/usr/lib/python3.11/site-packages/jupyterlab/federated_labextensions.py", line 208, in build_labextension
    builder = _ensure_builder(ext_path, core_path)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/lib/python3.11/site-packages/jupyterlab/federated_labextensions.py", line 307, in _ensure_builder
    raise ValueError(msg)

ValueError: Extensions require a devDependency on @jupyterlab/builder@^4.0.4, you have a dependency on 3.5.0

Exiting application: lab

It turns out that the cause is the mismatched version of the required @jupyterlab/builder https://github.com/jupyterlab/jupyterlab/blob/de28aca9ca8a60b25d28efdf359bb2c69d58c634/jupyterlab/staging/package.json#L185 https://github.com/mwouts/jupytext/blob/971b1e80e1b759fbf7fda3f9dc79d9ca9c3abcb9/packages/labextension/package.json#L66

parmentelat commented 1 year ago

Hey @MoetaYuko

At this particular point in time, the intended substrate for building the jlab extension is indeed jlab3 This is on purpose and not a misconfiguration, as the resulting code is suitable for both jlab3 and jlab4

This is expected to be a temporary thing, but the path towards a more sustainable scheme is yet to be defined

mwouts commented 11 months ago

This is fixed on the main branch. We have a release candidate as well, which you can try with pip install jupytext==1.16.0rc0. Let us know how it works for you. Thanks