-
Notifications
You must be signed in to change notification settings - Fork 4
feat(block-execution): use deepnote kernel in venv #16
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
saltenasl
merged 22 commits into
main
from
lukas/oss-53-run-notebooks-in-a-managed-deepnote-kernel
Oct 2, 2025
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
46ab116
feat(block-execution): use deepnote kernel in venv
saltenasl 8b17edd
fix: usage of any
saltenasl 635de8d
feat: isolated venv for every .deepnote file
saltenasl dc03549
fix: registered kernel is now recognized in ui
saltenasl c4e6bb0
feat: notebooks now run on deepnote kernel
saltenasl 15280c6
chore: code review comments from src/kernels/deepnote/deepnoteToolkit…
saltenasl 28c1f2d
chore: second part of code review comments
saltenasl 6e01551
fix: allow multiple block runs in a row by simplifying call flow
saltenasl 1be1eab
feat: respect venv when runing shell commands
saltenasl e32d9ec
feat: correct cwd to load files
saltenasl 263f04e
feat: progress indicators
saltenasl f9376b5
chore: code review comments
saltenasl d72c7ba
chore: bring back toolkit version constant
saltenasl 3b564ba
fix: hash venv name
saltenasl 81b5d7b
fix: cleanup server on cancellation
saltenasl c284ff0
fix: clarify kernel spec strategy
saltenasl d54e69e
feat: better windows support
saltenasl fb6c201
fix: increase timeout for deepnote kernel instantiation
saltenasl 82ad53c
fix: rm broken venv dir recursively
saltenasl 36c134b
fix: throw on std err during toolkit installation
saltenasl 77e899b
Revert "feat: better windows support"
saltenasl e10470b
fix: venv paths
saltenasl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import { inject, injectable } from 'inversify'; | ||
| import { CancellationToken, Uri, Event, EventEmitter } from 'vscode'; | ||
| import { JupyterServer, JupyterServerProvider } from '../../api'; | ||
| import { IExtensionSyncActivationService } from '../../platform/activation/types'; | ||
| import { IDisposableRegistry } from '../../platform/common/types'; | ||
| import { IJupyterServerProviderRegistry } from '../jupyter/types'; | ||
| import { JVSC_EXTENSION_ID } from '../../platform/common/constants'; | ||
| import { logger } from '../../platform/logging'; | ||
| import { DeepnoteServerNotFoundError } from '../../platform/errors/deepnoteServerNotFoundError'; | ||
| import { DeepnoteServerInfo, IDeepnoteServerProvider } from './types'; | ||
|
|
||
| /** | ||
| * Jupyter Server Provider for Deepnote kernels. | ||
| * This provider resolves server connections for Deepnote kernels. | ||
| */ | ||
| @injectable() | ||
| export class DeepnoteServerProvider | ||
| implements IDeepnoteServerProvider, IExtensionSyncActivationService, JupyterServerProvider | ||
| { | ||
| public readonly id = 'deepnote-server'; | ||
| private readonly _onDidChangeServers = new EventEmitter<void>(); | ||
| public readonly onDidChangeServers: Event<void> = this._onDidChangeServers.event; | ||
|
|
||
| // Map of server handles to server info | ||
| private servers = new Map<string, DeepnoteServerInfo>(); | ||
|
|
||
| constructor( | ||
| @inject(IJupyterServerProviderRegistry) | ||
| private readonly jupyterServerProviderRegistry: IJupyterServerProviderRegistry, | ||
| @inject(IDisposableRegistry) private readonly disposables: IDisposableRegistry | ||
| ) {} | ||
|
|
||
| public activate() { | ||
| // Register this server provider | ||
| const collection = this.jupyterServerProviderRegistry.createJupyterServerCollection( | ||
| JVSC_EXTENSION_ID, | ||
| this.id, | ||
| 'Deepnote Toolkit Server', | ||
| this | ||
| ); | ||
| this.disposables.push(collection); | ||
| logger.info('Deepnote server provider registered'); | ||
| } | ||
|
|
||
| /** | ||
| * Register a server for a specific handle. | ||
| * Called by DeepnoteKernelAutoSelector when a server is started. | ||
| */ | ||
| public registerServer(handle: string, serverInfo: DeepnoteServerInfo): void { | ||
| logger.info(`Registering Deepnote server: ${handle} -> ${serverInfo.url}`); | ||
| this.servers.set(handle, serverInfo); | ||
| this._onDidChangeServers.fire(); | ||
| } | ||
|
|
||
| /** | ||
| * Unregister a server for a specific handle. | ||
| * Called when the server is no longer needed or notebook is closed. | ||
| * No-op if the handle doesn't exist. | ||
| */ | ||
| public unregisterServer(handle: string): void { | ||
| if (this.servers.has(handle)) { | ||
| logger.info(`Unregistering Deepnote server: ${handle}`); | ||
| this.servers.delete(handle); | ||
| this._onDidChangeServers.fire(); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Dispose of all servers and resources. | ||
| */ | ||
| public dispose(): void { | ||
| logger.info('Disposing Deepnote server provider, clearing all registered servers'); | ||
| this.servers.clear(); | ||
| this._onDidChangeServers.dispose(); | ||
| } | ||
|
|
||
| /** | ||
| * Provides the list of available Deepnote servers. | ||
| */ | ||
| public async provideJupyterServers(_token: CancellationToken): Promise<JupyterServer[]> { | ||
| const servers: JupyterServer[] = []; | ||
| for (const [handle, info] of this.servers.entries()) { | ||
| servers.push({ | ||
| id: handle, | ||
| label: `Deepnote Toolkit (${info.port})`, | ||
| connectionInformation: { | ||
| baseUrl: Uri.parse(info.url), | ||
| token: info.token || '' | ||
| } | ||
| }); | ||
| } | ||
| return servers; | ||
| } | ||
|
|
||
| /** | ||
| * Resolves a Jupyter server by its handle. | ||
| * This is called by the kernel infrastructure when starting a kernel. | ||
| */ | ||
| public async resolveJupyterServer(server: JupyterServer, _token: CancellationToken): Promise<JupyterServer> { | ||
| logger.info(`Resolving Deepnote server: ${server.id}`); | ||
| const serverInfo = this.servers.get(server.id); | ||
|
|
||
| if (!serverInfo) { | ||
| throw new DeepnoteServerNotFoundError(server.id); | ||
| } | ||
|
|
||
| return { | ||
| id: server.id, | ||
| label: server.label, | ||
| connectionInformation: { | ||
| baseUrl: Uri.parse(serverInfo.url), | ||
| token: serverInfo.token || '' | ||
| } | ||
| }; | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.