Skip to content

Commit af35cb6

Browse files
authored
Cherry pick history bug for Azure ML CI && Make Jupyter server clickable (#13712)
* Fix: Getting an error on selecting an existing CI which has a display name from the historical CI's in the quick picks (#13642) * Make Jupyter Server name clickale to select Jupyter server (#13657) * Update Changelog and remove news files
1 parent 8c9d5bd commit af35cb6

File tree

8 files changed

+106
-17
lines changed

8 files changed

+106
-17
lines changed

CHANGELOG.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,71 @@
11
# Changelog
22

3+
## 2020.8.4 (2 September 2020)
4+
5+
### Enhancements
6+
7+
1. Make Jupyter Server name clickable to select Jupyter server.
8+
([#13656](https://github.com/Microsoft/vscode-python/issues/13656))
9+
10+
### Fixes
11+
12+
1. Fixed connection to a Compute Instance from the quickpicks history options.
13+
([#13387](https://github.com/Microsoft/vscode-python/issues/13387))
14+
15+
### Thanks
16+
17+
Thanks to the following projects which we fully rely on to provide some of
18+
our features:
19+
20+
- [debugpy](https://pypi.org/project/debugpy/)
21+
- [isort](https://pypi.org/project/isort/)
22+
- [jedi](https://pypi.org/project/jedi/)
23+
and [parso](https://pypi.org/project/parso/)
24+
- [Microsoft Python Language Server](https://github.com/microsoft/python-language-server)
25+
- [Pylance](https://github.com/microsoft/pylance-release)
26+
- [exuberant ctags](http://ctags.sourceforge.net/) (user-installed)
27+
- [rope](https://pypi.org/project/rope/) (user-installed)
28+
29+
Also thanks to the various projects we provide integrations with which help
30+
make this extension useful:
31+
32+
- Debugging support:
33+
[Django](https://pypi.org/project/Django/),
34+
[Flask](https://pypi.org/project/Flask/),
35+
[gevent](https://pypi.org/project/gevent/),
36+
[Jinja](https://pypi.org/project/Jinja/),
37+
[Pyramid](https://pypi.org/project/pyramid/),
38+
[PySpark](https://pypi.org/project/pyspark/),
39+
[Scrapy](https://pypi.org/project/Scrapy/),
40+
[Watson](https://pypi.org/project/Watson/)
41+
- Formatting:
42+
[autopep8](https://pypi.org/project/autopep8/),
43+
[black](https://pypi.org/project/black/),
44+
[yapf](https://pypi.org/project/yapf/)
45+
- Interpreter support:
46+
[conda](https://conda.io/),
47+
[direnv](https://direnv.net/),
48+
[pipenv](https://pypi.org/project/pipenv/),
49+
[pyenv](https://github.com/pyenv/pyenv),
50+
[venv](https://docs.python.org/3/library/venv.html#module-venv),
51+
[virtualenv](https://pypi.org/project/virtualenv/)
52+
- Linting:
53+
[bandit](https://pypi.org/project/bandit/),
54+
[flake8](https://pypi.org/project/flake8/),
55+
[mypy](https://pypi.org/project/mypy/),
56+
[prospector](https://pypi.org/project/prospector/),
57+
[pylint](https://pypi.org/project/pylint/),
58+
[pydocstyle](https://pypi.org/project/pydocstyle/),
59+
[pylama](https://pypi.org/project/pylama/)
60+
- Testing:
61+
[nose](https://pypi.org/project/nose/),
62+
[pytest](https://pypi.org/project/pytest/),
63+
[unittest](https://docs.python.org/3/library/unittest.html#module-unittest)
64+
65+
And finally thanks to the [Python](https://www.python.org/) development team and
66+
community for creating a fantastic programming language and community to be a
67+
part of!
68+
369
## 2020.8.3 (31 August 2020)
470

571
### Enhancements

src/client/datascience/common.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,23 @@ const AllowedKeys = {
4545
['execute_result']: new Set(Object.keys(dummyExecuteResultObj))
4646
};
4747

48-
export function getSavedUriList(globalState: Memento): { uri: string; time: number }[] {
49-
const uriList = globalState.get<{ uri: string; time: number }[]>(Settings.JupyterServerUriList);
48+
export function getSavedUriList(globalState: Memento): { uri: string; time: number; displayName?: string }[] {
49+
const uriList = globalState.get<{ uri: string; time: number; displayName?: string }[]>(
50+
Settings.JupyterServerUriList
51+
);
5052
return uriList
5153
? uriList.sort((a, b) => {
5254
return b.time - a.time;
5355
})
5456
: [];
5557
}
56-
export function addToUriList(globalState: Memento, uri: string, time: number) {
58+
export function addToUriList(globalState: Memento, uri: string, time: number, displayName: string) {
5759
const uriList = getSavedUriList(globalState);
5860

5961
const editList = uriList.filter((f, i) => {
6062
return f.uri !== uri && i < Settings.JupyterServerUriListMax - 1;
6163
});
62-
editList.splice(0, 0, { uri, time });
64+
editList.splice(0, 0, { uri, time, displayName });
6365

6466
globalState.update(Settings.JupyterServerUriList, editList).then(noop, noop);
6567
}

src/client/datascience/interactive-common/interactiveBase.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { EXTENSION_ROOT_DIR, isTestExecution, PYTHON_LANGUAGE } from '../../comm
3737
import { RemoveKernelToolbarInInteractiveWindow, RunByLine } from '../../common/experiments/groups';
3838
import { traceError, traceInfo, traceWarning } from '../../common/logger';
3939

40+
import { isNil } from 'lodash';
4041
import {
4142
IConfigurationService,
4243
IDisposableRegistry,
@@ -1162,10 +1163,13 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
11621163
if (serverConnection.localLaunch) {
11631164
localizedUri = localize.DataScience.localJupyterServer();
11641165
} else {
1165-
localizedUri = serverConnection.displayName;
1166-
11671166
// Log this remote URI into our MRU list
1168-
addToUriList(this.globalStorage, localizedUri, Date.now());
1167+
addToUriList(
1168+
this.globalStorage,
1169+
!isNil(serverConnection.url) ? serverConnection.url : serverConnection.displayName,
1170+
Date.now(),
1171+
serverConnection.displayName
1172+
);
11691173
}
11701174
}
11711175

src/client/datascience/jupyter/jupyterUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export function createRemoteConnectionInfo(
5959
return { dispose: noop };
6060
},
6161
dispose: noop,
62-
getAuthHeader: serverUri ? () => getJupyterServerUri(uri)?.authorizationHeader : undefined
62+
getAuthHeader: serverUri ? () => getJupyterServerUri(uri)?.authorizationHeader : undefined,
63+
url: uri
6364
};
6465
}

src/client/datascience/jupyter/serverSelector.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
'use strict';
55

66
import { inject, injectable, named } from 'inversify';
7+
import { isNil } from 'lodash';
78
import { ConfigurationTarget, Memento, QuickPickItem, Uri } from 'vscode';
89
import { IClipboard, ICommandManager } from '../../common/application/types';
910
import { GLOBAL_MEMENTO, IConfigurationService, IMemento } from '../../common/types';
@@ -26,6 +27,7 @@ const defaultUri = 'https://hostname:8080/?token=849d61a414abafab97bc4aab1f35477
2627
interface ISelectUriQuickPickItem extends QuickPickItem {
2728
newChoice: boolean;
2829
provider?: IJupyterUriProvider;
30+
url?: string;
2931
}
3032

3133
@injectable()
@@ -66,7 +68,7 @@ export class JupyterServerSelector {
6668
if (item.label === this.localLabel) {
6769
await this.setJupyterURIToLocal();
6870
} else if (!item.newChoice && !item.provider) {
69-
await this.setJupyterURIToRemote(item.label);
71+
await this.setJupyterURIToRemote(!isNil(item.url) ? item.url : item.label);
7072
} else if (!item.provider) {
7173
return this.selectRemoteURI.bind(this);
7274
} else {
@@ -208,9 +210,10 @@ export class JupyterServerSelector {
208210
if (uriItem.uri) {
209211
const uriDate = new Date(uriItem.time);
210212
items.push({
211-
label: uriItem.uri,
213+
label: !isNil(uriItem.displayName) ? uriItem.displayName : uriItem.uri,
212214
detail: DataScience.jupyterSelectURIMRUDetail().format(uriDate.toLocaleString()),
213-
newChoice: false
215+
newChoice: false,
216+
url: uriItem.uri
214217
});
215218
}
216219
});

src/client/datascience/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export interface IJupyterConnection extends Disposable {
7474
readonly token: string;
7575
readonly hostName: string;
7676
localProcExitCode: number | undefined;
77+
readonly url?: string;
7778
// tslint:disable-next-line: no-any
7879
getAuthHeader?(): any; // Snould be a json object
7980
}

src/datascience-ui/interactive-common/jupyterInfo.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class JupyterInfo extends React.Component<IJupyterInfoProps> {
3333
constructor(prop: IJupyterInfoProps) {
3434
super(prop);
3535
this.selectKernel = this.selectKernel.bind(this);
36+
this.selectServer = this.selectServer.bind(this);
3637
}
3738

3839
public render() {
@@ -59,11 +60,18 @@ export class JupyterInfo extends React.Component<IJupyterInfoProps> {
5960
maxWidth: getMaxWidth(displayNameTextSize)
6061
};
6162

63+
const ariaDisabled = this.props.isNotebookTrusted === undefined ? false : this.props.isNotebookTrusted;
6264
return (
6365
<div className="kernel-status" style={dynamicFont}>
6466
{this.renderTrustMessage()}
65-
<div className="kernel-status-section kernel-status-server" style={serverTextWidth} role="button">
66-
<div className="kernel-status-text" title={jupyterServerDisplayName}>
67+
<div className="kernel-status-section kernel-status-server" style={serverTextWidth}>
68+
<div
69+
className="kernel-status-text kernel-status-section-hoverable"
70+
style={serverTextWidth}
71+
onClick={this.selectServer}
72+
role="button"
73+
aria-disabled={ariaDisabled}
74+
>
6775
{getLocString('DataScience.jupyterServer', 'Jupyter Server')}: {jupyterServerDisplayName}
6876
</div>
6977
<Image
@@ -153,4 +161,8 @@ export class JupyterInfo extends React.Component<IJupyterInfoProps> {
153161

154162
return res[1];
155163
}
164+
165+
private selectServer(): void {
166+
this.props.selectServer();
167+
}
156168
}

src/test/datascience/jupyter/serverSelector.unit.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,31 +103,31 @@ suite('DataScience - Jupyter Server URI Selector', () => {
103103

104104
// Add in a new server
105105
const serverA1 = { uri: 'ServerA', time: 1, date: new Date(1) };
106-
addToUriList(mockStorage, serverA1.uri, serverA1.time);
106+
addToUriList(mockStorage, serverA1.uri, serverA1.time, serverA1.uri);
107107

108108
await ds.selectJupyterURI(true);
109109
assert.equal(quickPick?.items.length, 3, 'Wrong number of items in the quick pick');
110110
quickPickCheck(quickPick?.items[2], serverA1);
111111

112112
// Add in a second server, the newer server should be higher in the list due to newer time
113113
const serverB1 = { uri: 'ServerB', time: 2, date: new Date(2) };
114-
addToUriList(mockStorage, serverB1.uri, serverB1.time);
114+
addToUriList(mockStorage, serverB1.uri, serverB1.time, serverB1.uri);
115115
await ds.selectJupyterURI(true);
116116
assert.equal(quickPick?.items.length, 4, 'Wrong number of items in the quick pick');
117117
quickPickCheck(quickPick?.items[2], serverB1);
118118
quickPickCheck(quickPick?.items[3], serverA1);
119119

120120
// Reconnect to server A with a new time, it should now be higher in the list
121121
const serverA3 = { uri: 'ServerA', time: 3, date: new Date(3) };
122-
addToUriList(mockStorage, serverA3.uri, serverA3.time);
122+
addToUriList(mockStorage, serverA3.uri, serverA3.time, serverA3.uri);
123123
await ds.selectJupyterURI(true);
124124
assert.equal(quickPick?.items.length, 4, 'Wrong number of items in the quick pick');
125125
quickPickCheck(quickPick?.items[3], serverB1);
126126
quickPickCheck(quickPick?.items[2], serverA1);
127127

128128
// Verify that we stick to our settings limit
129129
for (let i = 0; i < Settings.JupyterServerUriListMax + 10; i = i + 1) {
130-
addToUriList(mockStorage, i.toString(), i);
130+
addToUriList(mockStorage, i.toString(), i, i.toString());
131131
}
132132

133133
await ds.selectJupyterURI(true);

0 commit comments

Comments
 (0)