Skip to content
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

Load widget scripts from all known Jupyter paths #10726

Merged
merged 27 commits into from
Jul 11, 2022
Merged

Load widget scripts from all known Jupyter paths #10726

merged 27 commits into from
Jul 11, 2022

Conversation

DonJayamanne
Copy link
Contributor

Fixes #10722

@codecov-commenter
Copy link

codecov-commenter commented Jul 7, 2022

Codecov Report

Merging #10726 (6b2889f) into main (47b7c29) will increase coverage by 0%.
The diff coverage is 79%.

❗ Current head 6b2889f differs from pull request most recent head ac212ce. Consider uploading reports for the commit ac212ce to get more accurate results

@@          Coverage Diff           @@
##            main   #10726   +/-   ##
======================================
  Coverage     62%      62%           
======================================
  Files        476      476           
  Lines      32983    33047   +64     
  Branches    5356     5381   +25     
======================================
+ Hits       20726    20799   +73     
+ Misses     10264    10256    -8     
+ Partials    1993     1992    -1     
Impacted Files Coverage Δ
...c/platform/common/platform/platformService.node.ts 65% <50%> (-2%) ⬇️
src/platform/common/utils/platform.node.ts 78% <66%> (ø)
src/kernels/raw/finder/jupyterPaths.node.ts 78% <80%> (+14%) ⬆️
src/kernels/kernelDependencyService.node.ts 81% <0%> (-5%) ⬇️
...rnels/raw/finder/localKernelSpecFinderBase.node.ts 81% <0%> (-3%) ⬇️
src/kernels/helpers.ts 61% <0%> (-1%) ⬇️
...lPythonAndRelatedNonPythonKernelSpecFinder.node.ts 70% <0%> (-1%) ⬇️
src/interactive-window/interactiveWindow.ts 72% <0%> (-1%) ⬇️
src/platform/msrCrypto/msrCrypto.js 16% <0%> (+<1%) ⬆️
src/platform/common/utils/localize.ts 75% <0%> (+<1%) ⬆️
... and 10 more

@DonJayamanne DonJayamanne force-pushed the issue10722 branch 2 times, most recently from 74ef137 to eb5c91b Compare July 9, 2022 07:21
: [];

if (jupyterPathVars.length > 0) {
jupyterPathVars.forEach(async (jupyterPath) => {
Copy link
Contributor Author

@DonJayamanne DonJayamanne Jul 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was wrong, basically we're not awaiting on this to complete, hence paths set will always be empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test for this as well

import { parseVersion } from '../utils/version.node';
import { NON_WINDOWS_PATH_VARIABLE_NAME, WINDOWS_PATH_VARIABLE_NAME } from './constants.node';
import { IPlatformService } from './types';

@injectable()
export class PlatformService implements IPlatformService {
private readonly _homeDir = Uri.file(os.homedir());
private readonly _homeDir = getUserHomeDir() || Uri.file(os.homedir());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified to ensure we use the same function everywhere.

private getCodeToExecute() {
if (!this.code) {
this.code = this.fs.readFile(
Uri.joinPath(this.context.extensionUri, 'pythonFiles', 'printJupyWidgetEntryPoints.py')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved code to a file, easier to manage.

import { Uri } from 'vscode';

export function fsPathToUri(path: string | undefined) {
return path ? Uri.file(path) : undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this as this just compilcates the code unencessarily by adding nullables to the return values, even when the path is not undefined.

I.e. if we call fsPathToUri(<some string value>) the return value is still nullable, when this is impossible.
This unnecessary nullable complicates the code, hence removing it.

@DonJayamanne DonJayamanne marked this pull request as ready for review July 11, 2022 07:12
@DonJayamanne DonJayamanne requested a review from a team as a code owner July 11, 2022 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support all Jupyter Paths when loading static resources
3 participants