Skip to content

ssh: register the Databricks %pip magic on serverless environment 5+ - #7263

Draft
anton-107 wants to merge 3 commits into
mainfrom
deco-28307-ssh-jupyter-pip-magics
Draft

anton-107 wants to merge 3 commits into
mainfrom
deco-28307-ssh-jupyter-pip-magics

Conversation

@anton-107

Copy link
Copy Markdown
Contributor

Changes

On runtimes whose PipMagicOverrides takes a logger (serverless environment 5+), jupyter-init.py now builds the magic the way dbruntime's own kernel does. The driver conf, logger and environment resource client come from the driver connection, and the Py4J entry point is passed only where it exists. The constructor gained keyword arguments across runtime releases, so only the ones the installed runtime accepts are passed. Older runtimes keep the existing path.

Why

On serverless environments 5 and 6, the IPython startup script failed to register the Databricks %pip magic:

  • v5 (client.5.12): PipMagicOverrides.__init__() missing 1 required positional argument: 'logger'
  • v6 (client.6.5): 'NoneType' object has no attribute 'getDriverConf', because Py4J is off and there is no entry point

Notebooks opened over the tunnel then fell back to IPython's stock %pip. This blocks moving the tunnel's default environment off 4 (DECO-28307).

Tests

Tested on prod AWS us-west-2 CPU serverless, with this jupyter-init.py as the session's IPython startup script, through a real Jupyter kernel:

v4 v5 v6
%pip registered by PipMagicOverrides (unchanged) PipMagicOverrides (was stock) PipMagicOverrides (was stock)
%pip install humanize n/a Databricks handler, package importable same
spark.range(3).count() n/a 3 3

On v4 a kernel started from the session can't be reached (loopback is blocked there), so v4 was checked with terminal IPython only. I did not test dedicated clusters; their code path is unchanged.

This pull request and its description were written by Isaac.

anton-107 and others added 2 commits October 30, 2026 15:28
The IPython startup script built PipMagicOverrides with its older
constructor. On serverless environment 5 the constructor requires a
logger, and on environment 6 there is no Py4J entry point, so the call
failed and notebooks fell back to IPython's stock %pip.

When the constructor takes a logger, build it from the driver connection
the same way dbruntime's own kernel does, passing only the keyword
arguments the installed runtime accepts. Older runtimes keep the
existing path.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 327738a

Run: 41665920062

Env 🔄​flaky ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 271 15 10:47
🔄​ aws-windows-latest-4core-16gb 1 272 13 9:51
✅​ azure linux-2core-8gb 270 15 12:38
✅​ azure-windows-latest-4core-16gb 272 13 6:08
✅​ gcp linux-2core-8gb 271 15 13:30
✅​ gcp-windows-latest-4core-16gb 273 13 11:34
Test Name aws-windows-latest-4core-16gb
🔄​ TestAccept 🔄​f
Top 10 slowest tests (at least 2 minutes):
duration env testname
4:38 gcp-windows-latest-4core-16gb TestImportDirWithOverwriteFlag
4:25 azure linux-2core-8gb TestAccept
4:12 gcp linux-2core-8gb TestAccept
4:04 aws linux-2core-8gb TestAccept
3:27 gcp linux-2core-8gb TestFilerWorkspaceFilesExtensionsStat
3:26 gcp-windows-latest-4core-16gb TestImportDir
2:58 azure-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsRead
2:08 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsDelete
2:02 azure-windows-latest-4core-16gb TestLock
2:00 gcp linux-2core-8gb TestSyncFullFileSync

Co-authored-by: Isaac <no-reply@databricks.com>

This branch has not been deployed

No deployments
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