Repository navigation
perf(session): render Colab Enterprise session button without importing aiplatform - #240
Merged
Merged
Conversation
…ng aiplatform Previously, `_display_view_session_details_button` imported `google.cloud.aiplatform.utils._ipython_utils.display_link` to render the "View Session Details" button in Colab Enterprise notebooks. Importing any submodule under `google.cloud.aiplatform` eagerly initializes the full Vertex AI SDK (`v1` and `v1beta1`), adding ~3 seconds of local import overhead when creating or attaching to a session. Inline the self-contained button HTML/JS snippet directly via `IPython.display` so the button renders with identical styling and `window.google.colab.openUrl` behavior without importing `aiplatform`.
Contributor
There was a problem hiding this comment.
Code Review
This pull request replaces the dependency on google.cloud.aiplatform for rendering the 'View Session Details' button in Colab Enterprise with an inline HTML/CSS/JS implementation. This change avoids a ~3-second delay caused by importing the full Vertex AI SDK on session connection. The button is now rendered directly using IPython.display.display and HTML. Corresponding unit tests have been updated to mock and assert the new HTML rendering behavior. There are no review comments, so I have no feedback to provide.
dborowitz
approved these changes
Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_display_view_session_details_buttoninstead of importinggoogle.cloud.aiplatform.utils._ipython_utils.display_link.google.cloud.aiplatformeagerly initializes the full Vertex AI SDK (v1andv1beta1), adding ~3 seconds of local import overhead when creating or attaching to a session in Colab Enterprise.IPython.displaypreserves the exact styling andwindow.google.colab.openUrlhost integration without importinggoogle.cloud.aiplatform.Testing
tests/unit/test_session.py(pytest tests/unit/test_session.py).pyink . --check) and Python 3.10 compatibility (vermin).