Skip to content

Update gather functionality to support 0.4.1 of python-program-analysis #8219

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

Merged
merged 46 commits into from
Nov 5, 2019

Conversation

greazer
Copy link
Member

@greazer greazer commented Oct 25, 2019

For #8202

  • 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!)
  • Appropriate comments and documentation strings in the code
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated
  • Test plan is updated as appropriate
  • package-lock.json has been regenerated by running npm install (if dependencies have changed)
  • The wiki is updated with any design decisions/details.

@greazer greazer added the no-changelog No news entry required label Oct 25, 2019
@codecov-io
Copy link

codecov-io commented Oct 25, 2019

Codecov Report

Merging #8219 into master will increase coverage by 0.11%.
The diff coverage is 57.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8219      +/-   ##
==========================================
+ Coverage   59.23%   59.35%   +0.11%     
==========================================
  Files         508      509       +1     
  Lines       23236    23267      +31     
  Branches     3750     3758       +8     
==========================================
+ Hits        13765    13809      +44     
+ Misses       8577     8559      -18     
- Partials      894      899       +5
Impacted Files Coverage Δ
src/datascience-ui/interactive-common/mainState.ts 50.94% <ø> (ø) ⬆️
...rc/client/datascience/jupyter/jupyterKernelSpec.ts 80% <ø> (ø) ⬆️
src/client/datascience/jupyter/jupyterImporter.ts 18.42% <ø> (ø) ⬆️
src/client/datascience/types.ts 100% <ø> (ø) ⬆️
src/client/telemetry/index.ts 86.13% <ø> (ø) ⬆️
src/client/common/types.ts 100% <ø> (ø) ⬆️
...ascience/jupyter/liveshare/guestJupyterNotebook.ts 14.92% <0%> (-0.23%) ⬇️
src/client/datascience/jupyter/jupyterNotebook.ts 6.02% <0%> (-0.02%) ⬇️
src/client/datascience/serviceRegistry.ts 0% <0%> (ø) ⬆️
src/client/common/utils/localize.ts 94.02% <100%> (+0.01%) ⬆️
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47b19d0...38aea3c. Read the comment docs.

Copy link

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

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

🕐

@rchiodo
Copy link

rchiodo commented Oct 28, 2019

    const expectedProgram = `# This file contains the minimal amount of code required to produce the code cell you gathered.\n${defaultCellMarker}\nfrom bokeh.plotting import show, figure, output_notebook\n\n${defaultCellMarker}\nx = [1,2,3,4,5]\ny = [21,9,15,17,4]\n\n${defaultCellMarker}\np=figure(title='demo',x_axis_label='x',y_axis_label='y')\n\n${defaultCellMarker}\np.line(x,y,line_width=2)\n\n${defaultCellMarker}\nshow(p)\n`;

This was changed so it should have failed?


Refers to: src/test/datascience/gather/gather.unit.test.ts:147 in af781c1. [](commit_id = af781c1, deletion_comment = False)

@greazer greazer requested a review from rchiodo November 4, 2019 19:33
"description": "Enable code gather for executed cells. For a gathered cell, that cell and only the code it depends on will be exported to a new notebook.",
"scope": "resource"
},
"python.dataScience.gatherToScript": {
Copy link

Choose a reason for hiding this comment

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

This seems weird. Why not just always open a notebook if coming from a notebook and always open a file if coming from a file? For interactive window users, they'd never find this command and would be put off by us opening a notebook

@@ -1088,6 +1088,11 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
this.notebook = await server.createNotebook(await this.getNotebookIdentity());
}

if (this.notebook) {
const uri: Uri = await this.getNotebookIdentity();
Copy link

Choose a reason for hiding this comment

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

await this.getNotebookIdentity [](start = 29, length = 30)

This second await is redundant. You could just cache the value from the first call.

@@ -114,6 +119,14 @@ class MockJupyterNotebook implements INotebook {
public async dispose(): Promise<void> {
return Promise.resolve();
}

public gatherCode(_c: ICell): string | undefined {
Copy link

Choose a reason for hiding this comment

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

You can remove these now too.

Copy link

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

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

:shipit:

@@ -44,52 +37,36 @@ export class GatherExecution implements IGatherExecution, INotebookExecutionLogg

traceInfo('Gathering tools have been activated');
}
public logExecution(vscCell: IVscCell): void {
const gatherCell = convertVscToGatherCell(vscCell);
Copy link
Member

@IanMatthewHuff IanMatthewHuff Nov 4, 2019

Choose a reason for hiding this comment

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

So I'm a bit nervous that we lost our cloneDeep here. Technically convert should not change the vscCell, but I'm worried someone else might tweak it. Was it a perf issue? #ByDesign

Copy link
Member

Choose a reason for hiding this comment

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

Talked with Rich, we'll take care of this before calling postExecute, so disregard this.


In reply to: 342290179 [](ancestors = 342290179)

@IanMatthewHuff
Copy link
Member

    // Edit the document so that it is dirty (add a space at the end)

Trailing whitespace is a linting error. This might be a bit hokey, but could you add it and remove it?


Refers to: src/client/datascience/gather/gatherListener.ts:155 in 6d92142. [](commit_id = 6d92142, deletion_comment = False)

Copy link

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

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

:shipit:

@greazer
Copy link
Member Author

greazer commented Nov 5, 2019

Thanks for the help Rich!

@rchiodo
Copy link

rchiodo commented Nov 5, 2019

Out of curiosity, why? Because it avoids an unnecessary getText call out was there an error in logic?

Out of curiosity, why? Because it avoids an unnecessary getText call out was there an error in logic?

Because that function is called A LOT. Every time we update code lenses. I wanted to preserver the O(n) of it if possible. And in case there were bugs, this will only affect gather then.

@rchiodo rchiodo merged commit 58a6e24 into master Nov 5, 2019
@rchiodo rchiodo deleted the dev/jimgries/update-gather-041 branch November 5, 2019 00:22
@lock lock bot locked as resolved and limited conversation to collaborators Nov 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
no-changelog No news entry required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants