Skip to content

Commit 11a9f1d

Browse files
authored
Remove unwanted Jupyter API (#21702)
Fixes microsoft/vscode-jupyter#13986
1 parent efcc3d7 commit 11a9f1d

File tree

4 files changed

+1
-115
lines changed

4 files changed

+1
-115
lines changed

pythonExtensionApi/src/main.ts

+1-59
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
import { CancellationToken, Event, Uri, WorkspaceFolder, QuickPickItem, extensions } from 'vscode';
4+
import { CancellationToken, Event, Uri, WorkspaceFolder, extensions } from 'vscode';
55

66
/*
77
* Do not introduce any breaking changes to this API.
@@ -12,9 +12,6 @@ export interface PythonExtension {
1212
* Promise indicating whether all parts of the extension have completed loading or not.
1313
*/
1414
ready: Promise<void>;
15-
jupyter: {
16-
registerHooks(): void;
17-
};
1815
debug: {
1916
/**
2017
* Generate an array of strings for commands to pass to the Python executable to launch the debugger for remote debugging.
@@ -33,20 +30,6 @@ export interface PythonExtension {
3330
getDebuggerPackagePath(): Promise<string | undefined>;
3431
};
3532

36-
datascience: {
37-
/**
38-
* Launches Data Viewer component.
39-
* @param dataProvider Instance that will be used by the Data Viewer component to fetch data.
40-
* @param title Data Viewer title
41-
*/
42-
showDataViewer(dataProvider: IDataViewerDataProvider, title: string): Promise<void>;
43-
/**
44-
* Registers a remote server provider component that's used to pick remote jupyter server URIs
45-
* @param serverProvider object called back when picking jupyter server URI
46-
*/
47-
registerRemoteServerProvider(serverProvider: IJupyterUriProvider): void;
48-
};
49-
5033
/**
5134
* These APIs provide a way for extensions to work with by python environments available in the user's machine
5235
* as found by the Python extension. See
@@ -123,47 +106,6 @@ export interface PythonExtension {
123106
};
124107
}
125108

126-
interface IJupyterServerUri {
127-
baseUrl: string;
128-
token: string;
129-
130-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
131-
authorizationHeader: any; // JSON object for authorization header.
132-
expiration?: Date; // Date/time when header expires and should be refreshed.
133-
displayName: string;
134-
}
135-
136-
type JupyterServerUriHandle = string;
137-
138-
export interface IJupyterUriProvider {
139-
readonly id: string; // Should be a unique string (like a guid)
140-
getQuickPickEntryItems(): QuickPickItem[];
141-
handleQuickPick(item: QuickPickItem, backEnabled: boolean): Promise<JupyterServerUriHandle | 'back' | undefined>;
142-
getServerUri(handle: JupyterServerUriHandle): Promise<IJupyterServerUri>;
143-
}
144-
145-
interface IDataFrameInfo {
146-
columns?: { key: string; type: ColumnType }[];
147-
indexColumn?: string;
148-
rowCount?: number;
149-
}
150-
151-
export interface IDataViewerDataProvider {
152-
dispose(): void;
153-
getDataFrameInfo(): Promise<IDataFrameInfo>;
154-
getAllRows(): Promise<IRowsResponse>;
155-
getRows(start: number, end: number): Promise<IRowsResponse>;
156-
}
157-
158-
enum ColumnType {
159-
String = 'string',
160-
Number = 'number',
161-
Bool = 'bool',
162-
}
163-
164-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
165-
type IRowsResponse = any[];
166-
167109
export type RefreshOptions = {
168110
/**
169111
* When `true`, force trigger a refresh regardless of whether a refresh was already triggered. Note this can be expensive so

src/client/api.ts

-12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
'use strict';
66

7-
import { noop } from 'lodash';
87
import { Uri, Event } from 'vscode';
98
import { BaseLanguageClient, LanguageClientOptions } from 'vscode-languageclient';
109
import { LanguageClient } from 'vscode-languageclient/node';
@@ -17,7 +16,6 @@ import { getDebugpyLauncherArgs, getDebugpyPackagePath } from './debugger/extens
1716
import { IInterpreterService } from './interpreter/contracts';
1817
import { IServiceContainer, IServiceManager } from './ioc/types';
1918
import { JupyterExtensionIntegration } from './jupyter/jupyterIntegration';
20-
import { IDataViewerDataProvider, IJupyterUriProvider } from './jupyter/types';
2119
import { traceError } from './logging';
2220
import { IDiscoveryAPI } from './pythonEnvironments/base/locator';
2321
import { buildEnvironmentApi } from './environmentApi';
@@ -111,16 +109,6 @@ export function buildApi(
111109
return { execCommand: pythonPath === '' ? undefined : [pythonPath] };
112110
},
113111
},
114-
// These are for backwards compatibility. Other extensions are using these APIs and we don't want
115-
// to force them to move to the jupyter extension ... yet.
116-
datascience: {
117-
registerRemoteServerProvider: jupyterIntegration
118-
? jupyterIntegration.registerRemoteServerProvider.bind(jupyterIntegration)
119-
: ((noop as unknown) as (serverProvider: IJupyterUriProvider) => void),
120-
showDataViewer: jupyterIntegration
121-
? jupyterIntegration.showDataViewer.bind(jupyterIntegration)
122-
: ((noop as unknown) as (dataProvider: IDataViewerDataProvider, title: string) => Promise<void>),
123-
},
124112
pylance: {
125113
createClient: (...args: any[]): BaseLanguageClient => {
126114
// Make sure we share output channel so that we can share one with

src/client/api/types.ts

-14
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,6 @@ export interface PythonExtension {
3333
getDebuggerPackagePath(): Promise<string | undefined>;
3434
};
3535

36-
datascience: {
37-
/**
38-
* Launches Data Viewer component.
39-
* @param dataProvider Instance that will be used by the Data Viewer component to fetch data.
40-
* @param title Data Viewer title
41-
*/
42-
showDataViewer(dataProvider: IDataViewerDataProvider, title: string): Promise<void>;
43-
/**
44-
* Registers a remote server provider component that's used to pick remote jupyter server URIs
45-
* @param serverProvider object called back when picking jupyter server URI
46-
*/
47-
registerRemoteServerProvider(serverProvider: IJupyterUriProvider): void;
48-
};
49-
5036
/**
5137
* These APIs provide a way for extensions to work with by python environments available in the user's machine
5238
* as found by the Python extension. See

src/client/jupyter/jupyterIntegration.ts

-30
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import {
3333
PythonEnvironmentsChangedEvent,
3434
} from '../interpreter/contracts';
3535
import { PythonEnvironment } from '../pythonEnvironments/info';
36-
import { IDataViewerDataProvider, IJupyterUriProvider } from './types';
3736
import { PylanceApi } from '../activation/node/pylanceApi';
3837
import { ExtensionContextKey } from '../common/application/contextKeys';
3938
/**
@@ -168,17 +167,6 @@ type JupyterExtensionApi = {
168167
* @param interpreterService
169168
*/
170169
registerPythonApi(interpreterService: PythonApiForJupyterExtension): void;
171-
/**
172-
* Launches Data Viewer component.
173-
* @param {IDataViewerDataProvider} dataProvider Instance that will be used by the Data Viewer component to fetch data.
174-
* @param {string} title Data Viewer title
175-
*/
176-
showDataViewer(dataProvider: IDataViewerDataProvider, title: string): Promise<void>;
177-
/**
178-
* Registers a remote server provider component that's used to pick remote jupyter server URIs
179-
* @param serverProvider object called back when picking jupyter server URI
180-
*/
181-
registerRemoteServerProvider(serverProvider: IJupyterUriProvider): void;
182170
};
183171

184172
@injectable()
@@ -286,24 +274,6 @@ export class JupyterExtensionIntegration {
286274
}
287275
}
288276

289-
public registerRemoteServerProvider(serverProvider: IJupyterUriProvider): void {
290-
this.getExtensionApi()
291-
.then((e) => {
292-
if (e) {
293-
e.registerRemoteServerProvider(serverProvider);
294-
}
295-
})
296-
.ignoreErrors();
297-
}
298-
299-
public async showDataViewer(dataProvider: IDataViewerDataProvider, title: string): Promise<void> {
300-
const api = await this.getExtensionApi();
301-
if (api) {
302-
return api.showDataViewer(dataProvider, title);
303-
}
304-
return undefined;
305-
}
306-
307277
private async getExtensionApi(): Promise<JupyterExtensionApi | undefined> {
308278
if (!this.pylanceExtension) {
309279
const pylanceExtension = this.extensions.getExtension<PylanceApi>(PYLANCE_EXTENSION_ID);

0 commit comments

Comments
 (0)