-
Notifications
You must be signed in to change notification settings - Fork 293
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
Web version of the DataFrame #10545
Web version of the DataFrame #10545
Conversation
Hmmm, the new test that I added for opening DataViewer from the debug menu looks to be failing in this PR. I'd expect my test was having issue, but I don't see it failing in the most recent schedule run: https://github.com/microsoft/vscode-jupyter/runs/7020267384?check_suite_focus=true. Might be something up here, I can help look into. That code path also uses the DataViewerDependencyService to check Pandas version. I can help show that scenario. |
src/test/datascience/data-viewing/dataViewerDependencyService.unit.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, although I think you could have made the unit tests much simpler with a sinon.stub of 'executeSilently' instead of having to mock the kernel behavior.
src/webviews/extension-side/dataviewer/dataViewerDependencyService.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We chatted in teams. Looks like this change will be a forcing factor for checking pandas version in the python debug scenario the right way. Instead of executing the code snippit on the kernel session we'll execute it on the activeDebugSession. And hey, we know the end to end test works now :).
src/webviews/extension-side/dataviewer/dataViewerDependencyService.ts
Outdated
Show resolved
Hide resolved
src/test/datascience/data-viewing/dataViewerDependencyService.unit.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API doesn't look right, we're picking random kernels, instead of a the kernel associated with the current execution.
src/webviews/extension-side/dataviewer/dataViewerDependencyService.ts
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## main #10545 +/- ##
======================================
- Coverage 71% 71% -1%
======================================
Files 472 473 +1
Lines 27993 28068 +75
Branches 4691 4702 +11
======================================
- Hits 19946 19937 -9
- Misses 6179 6262 +83
- Partials 1868 1869 +1
|
throw new Error('Not implemented'); | ||
} | ||
|
||
public async checkAndInstallMissingDependenciesOnEnvironment(interpreter: PythonEnvironment): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative I thought of was to keep the same method as before but to accept options or a variadic set of parameters. I thought that had unnecessary implications -- unnecessary since I did not intend to implement the installer to support the PythonEnvironment
in the web.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id still prefer to have the same method name and the same argument interpreter.
you can get the interpreter from the kernel. connectionMetadata. interpreter
.
ie it is doable, and i feel that's much better than having two methods, one for local and one for remote.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do like that idea! Thank you! I'll figure it out 👍
src/webviews/extension-side/dataviewer/dataViewerDependencyService.ts
Outdated
Show resolved
Hide resolved
src/test/datascience/data-viewing/dataViewerDependencyService.unit.test.ts
Show resolved
Hide resolved
src/test/datascience/data-viewing/dataViewerDependencyService.unit.test.ts
Show resolved
Hide resolved
src/webviews/extension-side/dataviewer/dataViewerDependencyService.ts
Outdated
Show resolved
Hide resolved
@DonJayamanne thank you for your feedback! I agree with all of them! 🙂 I'll do the updates! |
…ing feedback from Don and Rich at the same time
* Responsible for managing dependencies of a Data Viewer. | ||
*/ | ||
@injectable() | ||
export class DataViewerDependencyService implements IDataViewerDependencyService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need .web file naming since it's the class we inject in the web scenario? I'm guessing you might not have since it doesn't actually have web only dependencies, but in function is seems to be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should work in Node without troubles as long as IKernel is sent. I wouldn't think .web.ts
applies in that case.
@inject(IsCodeSpace) private isCodeSpace: boolean | ||
) {} | ||
|
||
private packaging(kernel: IKernel): 'pip' | 'conda' { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of different env types here. Might not be safe to just call everything not conda as pip. As a first pass we could just ignore the other types. Poetry and what not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's what we're doing 🤔 isConda ? 'conda' : 'pip'
src/webviews/extension-side/dataviewer/dataViewerDependencyService.ts
Outdated
Show resolved
Hide resolved
} | ||
|
||
public async checkAndInstallMissingDependenciesOnKernel(kernel: IKernel): Promise<void> { | ||
const pandasVersion = await this.getVersionOfPandas(kernel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tomorrow, if someone comes along and modifies the code to call this method instead of the ones with the argument, it's not wrong.
but will break things.
i think the problem is there's no way for someone to know which methods to call and when.
hence the suggestion to have a single method that takes the kernel argument.
as mentioned earlier from the kernel we can get the interpreter in one line.
we can get the kernel for any given resource as well, all you need is the nottebook or notebookuri. i
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do like that idea! Thank you! I'll figure it out 👍
|
||
const promise = dependencyService.checkAndInstallMissingDependencies(interpreter); | ||
const stub = sinon.stub(helpers, 'executeSilently'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if this works, however ifeel it might be easier to stub the kernel. session
methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it isn't working I'm hallucinating 😅 I wouldn't discard that possibility though
@@ -130,5 +130,6 @@ export interface IJupyterVariableDataProviderFactory { | |||
|
|||
export const IDataViewerDependencyService = Symbol('IDataViewerDependencyService'); | |||
export interface IDataViewerDependencyService { | |||
checkAndInstallMissingDependencies(interpreter: PythonEnvironment): Promise<void>; | |||
checkAndInstallMissingDependenciesOnEnvironment(environment: PythonEnvironment): Promise<void>; | |||
checkAndInstallMissingDependenciesOnKernel(kernel: IKernel): Promise<void>; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id prefer to haber a single method, two feels like a work around which introduces debt.
there's nothing preventing one from using the wrong method.
pythonEnv && | ||
(await this.dataViewerDependencyService.checkAndInstallMissingDependenciesOnEnvironment( | ||
pythonEnv | ||
)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait, will this work with remote debugging.
i don't think so.
ie if im debugging a remote kernel, then will this fixed path work?
i think we'll need to get that working as well for the web.
in there loader it didn't work, but now that we're enabling df viewer for web, 100% of web users will use remote kernels, hence this won't work when they're debugging.
again, i think this is what @IanMatthewHuff mentioned.
we'd need to change the code as we should be sending the request using the debugger instead of interpreter or kernel (whether it's local or remote)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the command to debug a python file with the Python extension is working on the web. I can't get to make it work.
Besides that, this approach you are pointing out would be broken on remote today, is that the case?
I would like to separate the problem of the debugger into a separate PR, because the debugger in itself is fairly complex and it does not seem to be working working on the web anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this file is using the pre-existing dataViewerDependencyService
, not the new one
@@ -39,7 +39,11 @@ export class DataViewerDependencyService implements IDataViewerDependencyService | |||
@inject(IsCodeSpace) private isCodeSpace: boolean | |||
) {} | |||
|
|||
public async checkAndInstallMissingDependencies(interpreter: PythonEnvironment): Promise<void> { | |||
public async checkAndInstallMissingDependenciesOnKernel(): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have two versions? Can't they both use the kernel?
After speaking with @rchiodo about the debugger, I will include the debugger changes in this PR. I will close it for now, to make sure we have something cleaner to review with the debugger changes included. |
The only thing missing on the web to enable the DataFrame features was to have a web-ready version of the
DataViewerDependencyService
.After discussing ideas with @DonJayamanne and @rchiodo , Rich's approach seemed the most straightforward way to add web support to
DataViewerDependencyService
. Rich's approach, as far as I understood, was to:DataViewerDependencyService
to take a dependency on theIKernel
and have it execute a%pip install pandas
instead of usingIInstaller
.%conda
or%pip
based on theIKernel
'sKernelConnectionMetadata
.%conda
if it had an interpreter (local case) that was conda based. Otherwise%pip
.This PR follows that approach. Besides that:
parseSemVer
function fromplatform/common/utils.node
toplatform/common/utils
.IDataViewerDependencyService
to the extension-side web service registry.removes the
isWebconditional from the
variableExplorerButtonCellFormatter.tsx`.Thus:
Fixes #9665
Fixes #10310
Feedback always appreciated!
package-lock.json
has been regenerated by runningnpm install
(if dependencies have changed).