-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use deno instead of Julia & .NET (#14943)
* Use deno instead of Julia * deno version * Install deno kernel * Fixes * Log path to deno kernel * Remove unwanted files * No need of postinstall for smoke tests * Fix tests
- Loading branch information
1 parent
941cef3
commit 0ee7acf
Showing
7 changed files
with
137 additions
and
209 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -30,7 +30,7 @@ env: | |
NODE_VERSION: 18.15.0 | ||
NPM_VERSION: 9.5.0 | ||
PYTHON_VERSION: 3.8 | ||
JULIA_VERSION: 1.5.2 | ||
DENO_VERSION: '~1.37' | ||
MOCHA_REPORTER_JUNIT: true # Use the mocha-multi-reporters and send output to both console (spec) and JUnit (mocha-junit-reporter). Also enables a reporter which exits the process running the tests if it haven't already. | ||
CACHE_NPM_DEPS: cache-npm | ||
CACHE_OUT_DIRECTORY: cache-out-directory | ||
|
@@ -47,7 +47,6 @@ env: | |
DISABLE_INSIDERS_EXTENSION: 1 # Disable prompts to install pre-release in tests (else it blocks activation of extension). | ||
VSC_JUPYTER_INSTRUMENT_CODE_FOR_COVERAGE: true | ||
VSC_JUPYTER_LOG_KERNEL_OUTPUT: true | ||
DOTNET_VERSION: 8.0.x | ||
|
||
jobs: | ||
# Make sure to cancel previous runs on a push | ||
|
@@ -602,35 +601,15 @@ jobs: | |
|
||
# Used by tests for non-python kernels. | ||
# Test are enabled via env variable `VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST` | ||
- name: Install Julia | ||
- name: Install Deno | ||
if: matrix.os != 'windows-latest' && matrix.tags != '^[^@]+$|@mandatory' && matrix.tags != '@widgets' && matrix.jupyterConnection != 'web' && matrix.jupyterConnection != 'remote' && matrix.tags != '@debugger' && matrix.tags != '@iw' && matrix.tags != '@webview|@export|@lsp|@variableViewer' | ||
uses: julia-actions/setup-julia@v1 | ||
uses: denoland/setup-deno@v1 | ||
with: | ||
version: ${{env.JULIA_VERSION}} | ||
deno-version: ${{ env.DENO_VERSION}} | ||
|
||
- name: Install Julia Kernel | ||
- name: Install Deno Kernel | ||
if: matrix.os != 'windows-latest' && matrix.tags != '^[^@]+$|@mandatory' && matrix.tags != '@widgets' && matrix.jupyterConnection != 'web' && matrix.jupyterConnection != 'remote' && matrix.tags != '@debugger' && matrix.tags != '@iw' && matrix.tags != '@webview|@export|@lsp|@variableViewer' | ||
shell: bash | ||
run: | | ||
julia -e ' | ||
using Pkg | ||
Pkg.add("IJulia")' | ||
- name: Install Dot.net | ||
if: matrix.os != 'windows-latest' && matrix.tags != '^[^@]+$|@mandatory' && matrix.tags != '@widgets' && matrix.jupyterConnection != 'web' && matrix.jupyterConnection != 'remote' && matrix.tags != '@debugger' && matrix.tags != '@iw' && matrix.tags != '@webview|@export|@lsp|@variableViewer' | ||
uses: actions/[email protected] | ||
with: | ||
dotnet-version: ${{env.DOTNET_VERSION}} | ||
|
||
- name: Install .NET Interactive | ||
if: matrix.os != 'windows-latest' && matrix.tags != '^[^@]+$|@mandatory' && matrix.tags != '@widgets' && matrix.jupyterConnection != 'web' && matrix.jupyterConnection != 'remote' && matrix.tags != '@debugger' && matrix.tags != '@iw' && matrix.tags != '@webview|@export|@lsp|@variableViewer' | ||
shell: bash -l {0} | ||
run: dotnet tool install -g --add-source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" Microsoft.dotnet-interactive | ||
|
||
- name: Install .NET Kernel | ||
if: matrix.os != 'windows-latest' && matrix.tags != '^[^@]+$|@mandatory' && matrix.tags != '@widgets' && matrix.jupyterConnection != 'web' && matrix.jupyterConnection != 'remote' && matrix.tags != '@debugger' && matrix.tags != '@iw' && matrix.tags != '@webview|@export|@lsp|@variableViewer' | ||
shell: bash -l {0} | ||
run: dotnet interactive jupyter install | ||
run: npx tsx ./build/installDenoKernel.ts | ||
|
||
- name: Create Virtual Env for Tests | ||
uses: ./.github/actions/create-venv-for-tests | ||
|
This file contains 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,92 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import * as path from 'path'; | ||
import * as os from 'os'; | ||
import * as fs from 'fs-extra'; | ||
import { execSync } from 'child_process'; | ||
|
||
const winJupyterPath = path.join('AppData', 'Roaming', 'jupyter', 'kernels'); | ||
const linuxJupyterPath = path.join('.local', 'share', 'jupyter', 'kernels'); | ||
const macJupyterPath = path.join('Library', 'Jupyter', 'kernels'); | ||
|
||
enum OSType { | ||
Unknown = 'Unknown', | ||
Windows = 'Windows', | ||
OSX = 'OSX', | ||
Linux = 'Linux' | ||
} | ||
|
||
// Return the OS type for the given platform string. | ||
function getOSType(platform: string = process.platform): OSType { | ||
if (/^win/.test(platform)) { | ||
return OSType.Windows; | ||
} else if (/^darwin/.test(platform)) { | ||
return OSType.OSX; | ||
} else if (/^linux/.test(platform)) { | ||
return OSType.Linux; | ||
} else { | ||
return OSType.Unknown; | ||
} | ||
} | ||
|
||
// Home path depends upon OS | ||
const homePath = os.homedir(); | ||
|
||
function getEnvironmentVariable(key: string): string | undefined { | ||
return process.env[key]; | ||
} | ||
|
||
function getUserHomeDir(): string { | ||
if (getOSType() === OSType.Windows) { | ||
return getEnvironmentVariable('USERPROFILE') || homePath; | ||
} | ||
const homeVar = getEnvironmentVariable('HOME') || getEnvironmentVariable('HOMEPATH') || homePath; | ||
|
||
// Make sure if linux, it uses linux separators | ||
return homeVar.replace(/\\/g, '/'); | ||
} | ||
|
||
function getKernelSpecRootPath() { | ||
switch (getOSType()) { | ||
case OSType.Windows: | ||
return path.join(getUserHomeDir(), winJupyterPath); | ||
case OSType.OSX: | ||
return path.join(getUserHomeDir(), macJupyterPath); | ||
default: | ||
return path.join(getUserHomeDir(), linuxJupyterPath); | ||
} | ||
} | ||
|
||
function getDenoExec() { | ||
return execSync('which deno').toString().trim(); | ||
} | ||
|
||
function getDenoKernelSpecPath() { | ||
return path.join(getKernelSpecRootPath(), 'deno', 'kernel.json'); | ||
} | ||
|
||
function registerKernel() { | ||
const denoKernelSpecPath = getDenoKernelSpecPath(); | ||
if (fs.existsSync(denoKernelSpecPath)) { | ||
console.log(`Deno kernel already registered at ${denoKernelSpecPath}`); | ||
return; | ||
} | ||
|
||
fs.mkdirpSync(path.dirname(denoKernelSpecPath)); | ||
fs.writeFileSync( | ||
denoKernelSpecPath, | ||
JSON.stringify( | ||
{ | ||
argv: [getDenoExec(), '--unstable', 'jupyter', '--kernel', '--conn', '{connection_file}'], | ||
display_name: 'Deno', | ||
language: 'typescript' | ||
}, | ||
null, | ||
4 | ||
) | ||
); | ||
console.log(`Deno kernel registered at ${denoKernelSpecPath}`); | ||
} | ||
|
||
registerKernel(); |
This file contains 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 was deleted.
Oops, something went wrong.
Oops, something went wrong.