Skip to content

Patch to fully support @jupyterlab/builder#98

Merged
Darshan808 merged 5 commits into
jupyterlab:mainfrom
Darshan808:patch-flag-issue
May 6, 2026
Merged

Patch to fully support @jupyterlab/builder#98
Darshan808 merged 5 commits into
jupyterlab:mainfrom
Darshan808:patch-flag-issue

Conversation

@Darshan808

Copy link
Copy Markdown
Member

References #81

Description

Downstream extensions that download latest jupyterlab but do not yet depend upon @jupyter/builder and still only depend upon @jupyterlab/builder are having trouble building due to some design modification in jupyter-builder.
This PR adds a patch to support @jupyterlab/builder too.

@Darshan808

Copy link
Copy Markdown
Member Author

We have a backward compatibility check, but it only tests for version mismatch error and does not test a successful build with @jupyterlab/builder.

def test_builder_version_mismatch(tmp_path):
extension_folder = tmp_path / "ext"
extension_folder.mkdir()
helper(str(extension_folder))
package_json_path = extension_folder / "package.json"
# Modify the @jupyterlab/builder version to an incompatible range
package_data = json.loads(package_json_path.read_text())
package_data["devDependencies"]["@jupyterlab/builder"] = "4.0.0"
package_json_path.write_text(json.dumps(package_data, indent=2))
env = os.environ.copy()
env.update({"YARN_ENABLE_IMMUTABLE_INSTALLS": "false"})
run(
["jlpm", "install"],
cwd=extension_folder,
check=True,
env=env,
)
# Note: we intentionally do not add `@jupyter/builder` here so that the
# extension only declares `@jupyterlab/builder` as the builder marker.
# This exercises the backwards-compatible version-check path.
with pytest.raises(subprocess.CalledProcessError) as excinfo:
run(
["jupyter-builder", "build", str(extension_folder)],
cwd=extension_folder,
check=True,
capture_output=True,
text=True,
)
# Check if the expected error message is in the output
assert re.search(
(
r"ValueError: Extensions require a devDependency on @jupyterlab/builder@\^.+?, "
r"you have a dependency on 4\.0\.0"
),
excinfo.value.stderr,
), "Expected version mismatch error message not found in output!"

@Darshan808

Darshan808 commented May 6, 2026

Copy link
Copy Markdown
Member Author

I added same tests to #99 as well and we can verify that currently @jupyterlab/builder is not supported and CI fails with

error: required option '--core-path ' not specified

But the same tests passes here.

@Darshan808 Darshan808 requested a review from krassowski May 6, 2026 14:30

@krassowski krassowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@Darshan808 Darshan808 merged commit 7614c1b into jupyterlab:main May 6, 2026
32 of 37 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in CFP '25 tracking May 6, 2026
@krassowski krassowski mentioned this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants