Skip to content

Upgrade project to jupyterlab 4x #729

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

Merged
merged 1 commit into from
Apr 8, 2025
Merged

Conversation

adityaramesh12
Copy link
Contributor

@adityaramesh12 adityaramesh12 commented Mar 22, 2025

Issue #, if available: #689

Description of changes:

  • Migrates project to JupyterLab 4 compatibility
  • Replaces CDN-based widget loading with local static extension packaging
  • Updates jQuery UI CSS source to use official CDN version 1.13.2
  • Modernizes build system by transitioning from setup.py to pyproject.toml using Hatch
  • Adds nbclassic package support to maintain classic notebook interface functionality (play button, neptune menu, etc.) in Notebook 7+ environment

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

@kmcginnes kmcginnes left a comment

Choose a reason for hiding this comment

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

There is much I don’t understand in these changes, so don’t count my approval too highly. But I don’t see anything major I would consider a blocker.

@@ -408,7 +440,7 @@ pip install graph-notebook
with

``` python
pip install ./dist/graph_notebook-4.6.2-py3-none-any.whl
pip install ./dist/graph_notebook-5.0.0-py3-none-any.whl --force-reinstall

Choose a reason for hiding this comment

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

Is the --force-reinstall necessary? If it is, would it be worth adding a comment about why it is necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

--force-reinstall not necessary per se. But since it is only for development, I thought it would be good to guarantees that subsequent builds with local changes will override existing installations, ensuring the latest changes are always reflected in the local installation.

try:
notebook = nbformat.read(f, as_version=4)
except Exception as e:
print(f"Notebook does not appear to be JSON: {str(e)}")

Choose a reason for hiding this comment

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

Is the error here always related to JSON format? Perhaps a more generic error message might be better? Something like:

Failed to parse Notebook file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. This was the only error i was noticing while prototyping a few things. Can make this more generic. Can i do it in a different PR while updating the change log tho?

// Add jQuery UI CSS via CDN
const jqueryUICss = document.createElement('link');
jqueryUICss.rel = 'stylesheet';
jqueryUICss.href = 'https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • The migration to JupyterLab 4.x required significant changes in how jQuery UI is integrated, moving from a webpack-managed CSS loading approach to a CDN-based solution with explicit initialization in the widget. This change, along with updated module federation configuration for jQuery dependencies, was necessitated by JupyterLab 4.x's stricter handling of external dependencies and CSS loading, as the previous webpack-based approach from JupyterLab 3.x was no longer compatible with the new architecture.

@michaelnchin michaelnchin self-requested a review April 3, 2025 19:34
Copy link
Member

@michaelnchin michaelnchin left a comment

Choose a reason for hiding this comment

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

LGTM. Built and tested these changes on a SageMaker JupyterLab 4 notebook instance, and all widgets and magics functionality appears intact per manual validation.

Awesome work on this migration - thank you @adityaramesh12!

@adityaramesh12 adityaramesh12 merged commit 9a4f6eb into main Apr 8, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

3 participants