Skip to content

Add Python Interactive Window#3034

Merged
DonJayamanne merged 140 commits into
masterfrom
dev/rchiodo/merge_datascience
Oct 30, 2018
Merged

Add Python Interactive Window#3034
DonJayamanne merged 140 commits into
masterfrom
dev/rchiodo/merge_datascience

Conversation

@rchiodo
Copy link
Copy Markdown

@rchiodo rchiodo commented Oct 26, 2018

Implements the Python Interactive window and associated commands to run python files as notebooks

Fix #2302

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Has a news entry file (remember to thank yourself!)
  • Unit tests & system/integration tests are added/updated
  • package-lock.json has been regenerated by running npm install (if dependencies have changed)

IanMatthewHuff and others added 30 commits September 26, 2018 10:41
…ienceChanges

merge in changes from the old data science branch
Tie this into vscode:prepublish
Have normal build still build react parts
Have normal hygiene still work on react parts
…webview_support

Adding building and hygiene support for react webview controls
…rtup (#2711)

* Fixup naming inconsistencies
* Add LanguageServerFolderService mock to other activationService tests.
* Dispatch on-type formatters to prevent them from overriding each other
* Move providers out of dispatcher, write tests
* Add news entry
* Remove reporting of ls version
* Remove file
…ngs.json (#2750)

* Prefix relative paths with './'
* Ensure relative path is prefixed with ./
I'm seeing compiler errors that have slipped in over the last few weeks. This PR fixes them. All but one are skipped tests that resulted in "unreachable code" errors. The other one is an error about a missing argument.
Implement basic webview support. This should allow us to iterate on the datascience controls using react.
This commit creates a history pane that just looks like the default "react" page but works inside of a webview panel.
Additionally it still makes it possible to load the index.html into a browser for debugging the react code standalone.
Implements the ability to talk to a jupyter kernel and execute cells.
Comment thread package.json Outdated
"pidusage": "^1.2.0",
"prismjs": "^1.15.0",
"promisify-node": "^0.5.0",
"react-json-tree": "^0.11.0",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please move all of the npm dependencies that are required by the React components into devDependencies
Why?

  • None of the npm dependencies required by the react app need to be deployed with the extension.
  • E.g. if react-json-tree is only used in the react app, then there's no need to deploy this with the extension.
  • When you WebPack, it will pull all necessary dependencies and bundle into your app (so that solves dependencies for react. Else you'll have reacct-json-tree in both node_modules as well as your react bundle.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Okay will do

Comment thread package.json Outdated
"semver": "^5.5.0",
"styled-jsx": "^3.1.0",
"sudo-prompt": "^8.2.0",
"temp": "^0.8.3",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can't we use tmp instead of adding a new dependency?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'll check

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Actually I can just use the IFileSystem.createTemporaryFile instead.

Comment thread scripts/inlinePlugin.js
@@ -0,0 +1,52 @@
class HelloWorldPlugin {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please move these into build\datascience.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sure

Comment thread src/client/activation/progress.ts Outdated
Comment thread src/client/common/application/types.ts Outdated
// To learn more about the benefits of this model, read https://goo.gl/KwvDNy.
// This link also includes instructions on opting out of this behavior.

const isLocalhost = Boolean(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

do we need this?
everything is local, so i dont see the need for service worker

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Probably not anymore. The original intent was to be able to debug it using a server. But we haven't been doing that. I'll remove it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

able to debug it using a server

What do you mean?

Comment thread src/client/debugger/extension/configProviders/pythonV2Provider.ts
Comment thread package.json Outdated
"@nteract/transform-model-debug": "^3.2.3",
"@nteract/transform-plotly": "^3.2.3",
"@nteract/transforms": "^4.4.4",
"@types/prismjs": "^1.9.0",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@types/prismjs must go in devDependencies

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Okay I'll move it.

Comment thread package.json Outdated
"dependencies": {
"@jupyterlab/services": "^3.1.4",
"@nteract/transform-dataresource": "^4.3.5",
"@nteract/transform-geojson": "^3.2.3",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please see comment related to moving react dependencies into devDependencies (only if using in react alone).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Okay will do.

Comment thread package.json Outdated
"tmp": "^0.0.29",
"tree-kill": "^1.2.0",
"typed-promisify": "^0.4.0",
"typed-react-markdown": "^0.1.0",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please move type definitions into devDependencies.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Will do

Copy link
Copy Markdown

@DonJayamanne DonJayamanne left a comment

Choose a reason for hiding this comment

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

I'm concerned about the test coverage.
We don't seem to have must tests for the new code

Comment thread src/test/datascience/datascience.unit.test.ts

// tslint:disable-next-line:no-function-expression
(function() {
const origRequire = Module.prototype.require;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note: This gets applied globally (i.e. this applies to all tests), hence might as well move into a common area.
Similar to what we do today in src/test/vscode-mock.ts and gets initialized in src/test/unittests.ts as follows:

export function runTests(testOptions?: { grep?: string; timeout?: number }) {
    vscodeMoscks.initialize();
	`<CSS Mocks> initialize`

Comment thread src/test/datascience/history.unit.test.tsx
@@ -0,0 +1,165 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As these tests can take upto a minute, please move these into history.test.tsx.
Or move into history.functional.test.tsx
& then create a new test runner for these tests, we need to ensure the *.unit.test.ts tests still run fast without spawning processes, etc.
All *.unit.test.ts tests are considered OS agnostic.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

These are OS agnostic but they don't require or use VS code. I guess I can create another test runner for now.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah not sure how long that will take though. If we want to ship this by Wednesday I'm not sure if I can get this done and the other stuff I have to do by then.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No, lets discuss this on Monday.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

These tests (when jupyter is present) take about 7 or 8 seconds.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does this spawn any process or require python?
I believe they do, hence the reason they could take a while.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes they spawn jupyter using the python -m command.

Comment thread src/test/datascience/reactHelpers.ts
Comment thread src/test/datascience/reactHelpers.ts
Copy link
Copy Markdown

@DonJayamanne DonJayamanne left a comment

Choose a reason for hiding this comment

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

Approved accidentally

Comment thread src/client/datascience/jupyterServer.ts Outdated
@brettcannon
Copy link
Copy Markdown
Member

What is history-react? Was all of that written from scratch or is this some external project that you are embedding? Is there any external project that is being embedded?

@rchiodo
Copy link
Copy Markdown
Author

rchiodo commented Oct 29, 2018

      What is history-react? Was all of that written from scratch or is this some external project that you are embedding? Is there any external project that is being embedded?

That's just a directory of the code we've written. It's not somebody else's code. It's our UI.

It's called history-react because we wanted it to be clear it was using reactjs.

@rchiodo
Copy link
Copy Markdown
Author

rchiodo commented Oct 29, 2018

There are new dependencies though. You can see them in package.json. We embed a whole bunch of react controls to get the UI to work.

@brettcannon
Copy link
Copy Markdown
Member

@rchiodo "Embed" as in there are files you copied from somewhere else?

Copy link
Copy Markdown
Member

@brettcannon brettcannon left a comment

Choose a reason for hiding this comment

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

Marking as "request changes" to make sure we don't accidentally merge while we work out 3rd-party project details.

@rchiodo
Copy link
Copy Markdown
Author

rchiodo commented Oct 29, 2018

Well sort of. Most of the code is just npm installed. There is one set of regex's I copied from prismjs python code. (MIT licensed). However prism is also npm installed so I think it should be captured in the oss governance stuff.

@rchiodo
Copy link
Copy Markdown
Author

rchiodo commented Oct 29, 2018

Just to put it here in case we forget, the src\client\datascience\history-react\transforms.ts is essentially a copy of this file here:
https://github.com/nteract/nteract/blob/master/packages/transforms-full/src/index.js
but with the vegas stuff commented out.

@brettcannon
Copy link
Copy Markdown
Member

@rchiodo should we have a news entry for #2302 in this PR?

@rchiodo
Copy link
Copy Markdown
Author

rchiodo commented Oct 29, 2018

That's probably a good idea. Now I have a number for the news entry I added. I'll renumber it.

@DonJayamanne DonJayamanne merged commit e395064 into master Oct 30, 2018
@brettcannon brettcannon deleted the dev/rchiodo/merge_datascience branch October 31, 2018 17:20
@lock lock Bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run code region

8 participants