From d7dccf5f9dbe51a1fad42b46e945c92d4738a4f8 Mon Sep 17 00:00:00 2001 From: Eliaazzz Date: Thu, 2 Apr 2026 20:02:35 +1100 Subject: [PATCH 1/2] Migrate JupyterLab sidepanel extension to prebuilt package distribution Replace deprecated jupyter labextension install/link workflow with pip-installable prebuilt extension for JupyterLab 4+ compatibility. - Add install.json for prebuilt extension discovery metadata - Add style/index.js CSS entry point and styleModule field in package.json - Include js in package.json files glob so style/index.js is published - Add Extensions and Extensions :: Prebuilt classifiers to pyproject.toml - Add missing src/yaml/* to tsconfig.json includes - Remove deprecated labextension install/link/build instructions from READMEs - Replace ipywidgets labextension install with pip install in Interactive README --- .../apache_beam/runners/interactive/README.md | 15 +----- .../README.md | 52 +++++-------------- .../install.json | 5 ++ .../package.json | 3 +- .../pyproject.toml | 2 + .../style/index.css | 3 -- .../style/index.js | 16 ++++++ .../tsconfig.json | 1 + 8 files changed, 40 insertions(+), 57 deletions(-) create mode 100644 sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/install.json create mode 100644 sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/style/index.js diff --git a/sdks/python/apache_beam/runners/interactive/README.md b/sdks/python/apache_beam/runners/interactive/README.md index ff6c57a94e61..f95b2765c3fa 100644 --- a/sdks/python/apache_beam/runners/interactive/README.md +++ b/sdks/python/apache_beam/runners/interactive/README.md @@ -244,23 +244,10 @@ a quick reference). For a more general and complete getting started guide, see jupyter kernelspec list ``` -* Extend JupyterLab through labextension. **Note**: labextension is different from nbextension - from pre-lab jupyter notebooks. - - All jupyter labextensions need nodejs - - ```bash - # Homebrew users do - brew install node - # Or Conda users do - conda install -c conda-forge nodejs - ``` - - Enable ipywidgets +* Install ipywidgets (includes the JupyterLab widget manager as a prebuilt extension): ```bash pip install ipywidgets - jupyter labextension install @jupyter-widgets/jupyterlab-manager ``` ### Start the notebook diff --git a/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/README.md b/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/README.md index 83fddf491f68..4c0baf3b2d53 100644 --- a/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/README.md +++ b/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/README.md @@ -31,41 +31,22 @@ Includes two different side panels: ## Installation -There are two ways to install the extension: - -### 1. Via pip (recommended) - -The extension is now available as a Python package on PyPI. You can install it with: +This extension is distributed as a prebuilt Python package. Install it with pip: ```bash pip install apache-beam-jupyterlab-sidepanel ``` -After installation, rebuild JupyterLab to activate the extension: - -```bash -jupyter lab clean -jupyter lab build -``` - -Then restart JupyterLab. The side panels will be available automatically. +Then restart JupyterLab. The side panels will be available automatically — no +`jupyter lab build` step is needed. - -### 2. Via JupyterLab Extension Manager (legacy, will be deprecated soon) +You can verify the extension is installed: ```bash -jupyter labextension install apache-beam-jupyterlab-sidepanel +jupyter labextension list ``` -This installs the extension using JupyterLab's legacy extension system. - ---- - -## Notes - -- Pip installation is now the preferred method as it handles Python packaging and JupyterLab extension registration seamlessly. -- After any upgrade or reinstallation, always rebuild JupyterLab to ensure the extension is activated. -- For detailed usage and development, refer to the source code and issues on [GitHub](https://github.com/apache/beam). +The extension should appear under the **prebuilt extensions** section. --- @@ -90,15 +71,12 @@ The `jlpm` command is JupyterLab's pinned version of # Install dependencies jlpm -# Build Typescript source -jlpm build -# Link your development version of the extension with JupyterLab -jupyter labextension link . -# Rebuild Typescript source after making changes -jlpm build -# Rebuild JupyterLab after making any changes -jupyter lab build +# Install the extension in editable mode (runs an initial JS build) +pip install -e . + +# Verify installation +jupyter labextension list ``` You can watch the source directory and run JupyterLab in watch mode to watch for changes in the extension's source and automatically rebuild the extension and application. @@ -110,7 +88,7 @@ jlpm watch jupyter lab --watch ``` -Now every change will be built locally and bundled into JupyterLab. Be sure to refresh your browser page after saving file changes to reload the extension (note: you'll need to wait for webpack to finish, which can take 10s+ at times). +Now every change will be built locally and bundled into JupyterLab. Be sure to refresh your browser page after saving file changes to reload the extension (note: you'll need to wait for the build to finish, which can take 10s+ at times). ### Test @@ -214,9 +192,5 @@ $PREFIX/share/jupyter/labextensions/apache-beam-jupyterlab-sidepanel/ ### Uninstall ```bash -jupyter labextension uninstall apache-beam-jupyterlab-sidepanel -``` -or -```bash -pip uninstall apache-beam-jupyterlab-sidepanel +pip uninstall apache_beam_jupyterlab_sidepanel ``` diff --git a/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/install.json b/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/install.json new file mode 100644 index 000000000000..3ef6567c6a81 --- /dev/null +++ b/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/install.json @@ -0,0 +1,5 @@ +{ + "packageManager": "python", + "packageName": "apache_beam_jupyterlab_sidepanel", + "uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package apache_beam_jupyterlab_sidepanel" +} diff --git a/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/package.json b/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/package.json index eef3fcaa80f4..6bca80350ff7 100644 --- a/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/package.json +++ b/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/package.json @@ -15,7 +15,7 @@ "author": "apache-beam", "files": [ "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}", - "style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}" + "style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}" ], "main": "lib/index.js", "types": "lib/index.d.ts", @@ -100,6 +100,7 @@ "style/*.css", "style/index.js" ], + "styleModule": "style/index.js", "jupyterlab": { "extension": true, "outputDir": "apache_beam_jupyterlab_sidepanel/labextension" diff --git a/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/pyproject.toml b/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/pyproject.toml index 6831535a2c1e..a28fd40b2ca6 100644 --- a/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/pyproject.toml +++ b/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/pyproject.toml @@ -33,6 +33,8 @@ classifiers = [ "Framework :: Jupyter", "Framework :: Jupyter :: JupyterLab", "Framework :: Jupyter :: JupyterLab :: 4", + "Framework :: Jupyter :: JupyterLab :: Extensions", + "Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", ] diff --git a/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/style/index.css b/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/style/index.css index 1a158f9bfe46..1b2227845b69 100644 --- a/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/style/index.css +++ b/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/style/index.css @@ -18,6 +18,3 @@ @import './inspector/Inspectables.css'; @import './inspector/InspectableView.css'; @import './inspector/InteractiveInspector.css'; -@import './yaml/Yaml.css'; -@import './yaml/YamlEditor.css'; -@import './yaml/YamlFlow.css'; \ No newline at end of file diff --git a/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/style/index.js b/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/style/index.js new file mode 100644 index 000000000000..5f377b2826a5 --- /dev/null +++ b/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/style/index.js @@ -0,0 +1,16 @@ +// Licensed under the Apache License, Version 2.0 (the 'License'); you may not +// use this file except in compliance with the License. You may obtain a copy of +// the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations under +// the License. + +import './index.css'; +import './yaml/Yaml.css'; +import './yaml/YamlEditor.css'; +import './yaml/YamlFlow.css'; diff --git a/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/tsconfig.json b/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/tsconfig.json index c684cabf44a3..058bf17e1861 100644 --- a/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/tsconfig.json +++ b/sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/tsconfig.json @@ -29,6 +29,7 @@ "src/common/*", "src/kernel/*", "src/inspector/*", + "src/yaml/*", "src/__tests__/**/*" ] } From 5005740f3132740903fd03a583ebf5ec77e753be Mon Sep 17 00:00:00 2001 From: Eliaazzz Date: Sat, 11 Apr 2026 17:52:39 +1000 Subject: [PATCH 2/2] Retrigger CI