Skip to content

perf(session): render Colab Enterprise session button without importing aiplatform - #240

Merged
dborowitz merged 1 commit into
mainfrom
keep-session-details-button
Nov 19, 2026
Merged

dborowitz merged 1 commit into
mainfrom
keep-session-details-button

Conversation

@tim-u

@tim-u tim-u commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Inline the Colab Enterprise "View Session Details" HTML/JS button snippet in _display_view_session_details_button instead of importing google.cloud.aiplatform.utils._ipython_utils.display_link.
  • 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 in Colab Enterprise.
  • Rendering the self-contained button markup directly via IPython.display preserves the exact styling and window.google.colab.openUrl host integration without importing google.cloud.aiplatform.

Testing

  • Updated unit tests in tests/unit/test_session.py (pytest tests/unit/test_session.py).
  • Verified formatting (pyink . --check) and Python 3.10 compatibility (vermin).

…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`.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@tim-u
tim-u requested a review from dborowitz November 18, 2026 21:30
@dborowitz
dborowitz merged commit 93cd280 into main Nov 19, 2026
28 checks passed
@dborowitz
dborowitz deleted the keep-session-details-button branch November 19, 2026 18:32
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.

2 participants