Skip to content

Commit f1deef6

Browse files
authored
Make sure language is used when picking kernel specs (microsoft#5628)
1 parent df3ed6d commit f1deef6

9 files changed

Lines changed: 21573 additions & 5 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#-------------------------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
4+
#-------------------------------------------------------------------------------------------------------------
5+
6+
FROM node:8
7+
8+
# Configure apt
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
RUN apt-get update \
11+
&& apt-get -y install --no-install-recommends apt-utils 2>&1
12+
13+
# Verify git and needed tools are installed
14+
RUN apt-get install -y git procps
15+
16+
# Remove outdated yarn from /opt and install via package
17+
# so it can be easily updated via apt-get upgrade yarn
18+
RUN rm -rf /opt/yarn-* \
19+
&& rm -f /usr/local/bin/yarn \
20+
&& rm -f /usr/local/bin/yarnpkg \
21+
&& apt-get install -y curl apt-transport-https lsb-release \
22+
&& curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \
23+
&& echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
24+
&& apt-get update \
25+
&& apt-get -y install --no-install-recommends yarn
26+
27+
# Install tslint and typescript
28+
RUN npm install -g tslint typescript
29+
30+
# Clean up
31+
RUN apt-get autoremove -y \
32+
&& apt-get clean -y \
33+
&& rm -rf /var/lib/apt/lists/*
34+
ENV DEBIAN_FRONTEND=dialog

.devcontainer/devcontainer.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
2+
{
3+
"name": "Node.js 8 & TypeScript",
4+
"dockerFile": "Dockerfile",
5+
"extensions": [
6+
"ms-vscode.vscode-typescript-tslint-plugin"
7+
]
8+
}

.vscode/launch.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22
{
33
"version": "0.1.0",
44
"configurations": [
5+
{
6+
"name": "Extension inside container",
7+
"type": "extensionHost",
8+
"request": "launch",
9+
"runtimeExecutable": "${execPath}",
10+
"args": [
11+
"--extensionDevelopmentPath=${workspaceFolder}", "${workspaceFolder}/data"
12+
],
13+
"stopOnEntry": false,
14+
"smartStep": true,
15+
"sourceMaps": true,
16+
"outFiles": [
17+
"${workspaceFolder}/out/**/*"
18+
],
19+
"preLaunchTask": "Compile"
20+
},
521
{
622
"name": "Python: Current File with iPython",
723
"type": "python",

data/.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.pythonPath": "/usr/bin/python3"
3+
}

data/get-pip.py

Lines changed: 21492 additions & 0 deletions
Large diffs are not rendered by default.

data/test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#%%
2+
print('hello')

news/2 Fixes/5586.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix problems if other language kernels are installed that are using python under the covers (bash is one such example).

package-lock.json

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/client/datascience/jupyter/jupyterExecution.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -590,14 +590,17 @@ export class JupyterExecutionBase implements IJupyterExecution {
590590
const spec = specs[i];
591591
let score = 0;
592592

593-
if (spec && spec.path && spec.path.length > 0 && info && spec.path === info.path) {
594-
// Path match
595-
score += 10;
596-
}
593+
// First match on language. No point if not python.
597594
if (spec && spec.language && spec.language.toLocaleLowerCase() === 'python') {
598595
// Language match
599596
score += 1;
600597

598+
// See if the path matches. Don't bother if the language doesn't.
599+
if (spec && spec.path && spec.path.length > 0 && info && spec.path === info.path) {
600+
// Path match
601+
score += 10;
602+
}
603+
601604
// See if the version is the same
602605
if (info && info.version && specDetails[i]) {
603606
const details = specDetails[i];

0 commit comments

Comments
 (0)