Repository navigation
feat(packaging): include managed-spark-cell-monitoring in interactive extra - #246
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request integrates managed-spark-cell-monitoring directly into the interactive extra dependencies, making %cellmonitor available automatically. It updates the IPython extension loading logic in _ipython.py to support hook-attaching extensions (like cell monitoring) even when their magics are already present, and adds comprehensive unit tests to verify loading, unloading, and coexistence behaviors. I have no feedback to provide as there are no review comments.
ptch314
self-requested a review
December 2, 2026 16:35
ptch314
approved these changes
Dec 2, 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
managed-spark-cell-monitoring[connect]>=1.1.0,<2.0toextras_require["interactive"]insetup.pyso installinggoogle-cloud-spark-connect[client,interactive](or[spark,interactive]/[interactive]) automatically installs and enables%cellmonitorand Spark Connect cell monitoring in IPython/Jupyter notebooks.google/cloud/managed_spark_connect/_ipython.pydiscovered when testing withmanaged-spark-cell-monitoring==1.1.0:managed-spark-cell-monitoringdefines%cellmonitorinmanaged_spark_cell_monitoringrather thanmanaged_spark_cell_monitoring.spark_connect, so_unload_extras_for_shellpreviously failed_is_from_module(..., ext_name)and left%cellmonitorbehind when disablingManagedSparkConnect.enable_extras._EXTRAS_EXTENSIONSnow specifies the magic package prefix (managed_spark_cell_monitoring) so disable/re-enable toggles cleanly.%cellmonitoralready exists:_is_extension_loadedpreviously skipped loading an extension if all of its magics were already registered. That shortcut only makes sense for pure-magic extensions (managed_spark_magics), notmanaged_spark_cell_monitoring.spark_connect, which must still load to attachSparkConnectCellControllercell hooks when%cellmonitorwas already registered (for example by classicmanaged_spark_cell_monitoringor a user override)._EXTRAS_EXTENSIONSnow marksmagics_only=Falseformanaged_spark_cell_monitoring.spark_connectwhile preserving any pre-existing%cellmonitormagic.README.mdandDEVELOPING.mdto reflect thatmanaged-spark-cell-monitoring/%cellmonitoris included in[interactive].tests/unit/test_init.pyandtests/unit/test_cell_monitoring.pycovering dependency availability, import order (cellmonitor_load_ext_first), pre-existing%cellmonitor, user-overwritten%cellmonitoracross disable/re-enable, and pre-loaded%load_ext managed_spark_cell_monitoring.spark_connect.Testing
google_cloud_spark_connect-2.3.1-py3-none-any.whl[interactive,client]into a fresh Python 3.13 venv (pip checkclean; verified auto-load,%cellmonitor,ipykernel, andenable_extrastoggling)ManagedSparkSessionauto-loaded%cellmonitorwithout manual%load_extand rendered liveManagedSparkCellWidgetprogressScreenshots
Auto-enabled extension on load:

Clicking through different widget features:


