Skip to content

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

Merged
Rich Chiodo (rchiodo) merged 46 commits into
masterfrom
dev/jimgries/update-gather-041
Nov 5, 2019
Merged

Rich Chiodo (rchiodo) merged 46 commits into
masterfrom
dev/jimgries/update-gather-041

Conversation

@greazer

Copy link
Copy Markdown

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.

@codecov-io

Codecov (codecov-io) commented Oct 25, 2019 •

Copy link
Copy Markdown

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.

Comment thread src/client/datascience/editor-integration/cellhashprovider.ts Outdated

@rchiodo Rich Chiodo (rchiodo) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🕐

Comment thread src/client/datascience/gather/gatherListener.ts Outdated
Comment thread src/client/datascience/interactive-ipynb/nativeEditor.ts Outdated
Comment thread src/client/datascience/interactive-ipynb/nativeEditorProvider.ts Outdated
Comment thread src/client/datascience/interactive-ipynb/nativeEditorProvider.ts Outdated
Comment thread src/client/datascience/interactive-ipynb/nativeEditorProvider.ts Outdated
Comment thread src/client/datascience/jupyter/jupyterExporter.ts Outdated
Comment thread src/client/datascience/jupyter/jupyterExporter.ts Outdated
Comment thread src/client/datascience/cellFactory.ts Outdated
@rchiodo

Copy link
Copy Markdown
    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)

Comment thread src/client/datascience/gather/gather.ts Outdated
Comment thread src/client/datascience/gather/gather.ts Outdated
Comment thread src/client/datascience/interactive-ipynb/nativeEditorProvider.ts Outdated
Comment thread package.json
"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
Copy Markdown

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

}

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

Copy link
Copy Markdown

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.

Comment thread src/client/datascience/jupyter/liveshare/guestJupyterNotebook.ts Outdated
return Promise.resolve();
}

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

Copy link
Copy Markdown

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.

@rchiodo Rich Chiodo (rchiodo) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

:shipit:

Comment thread src/client/common/utils/localize.ts
traceInfo('Gathering tools have been activated');
}
public logExecution(vscCell: IVscCell): void {
const gatherCell = convertVscToGatherCell(vscCell);

@IanMatthewHuff Ian Huff (IanMatthewHuff) Nov 4, 2019 •

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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)

@rchiodo Rich Chiodo (rchiodo) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

:shipit:

@greazer

Copy link
Copy Markdown
Author

Thanks for the help Rich!

@rchiodo

Copy link
Copy Markdown

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
Rich Chiodo (rchiodo) merged commit 58a6e24 into master Nov 5, 2019
@rchiodo
Rich Chiodo (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