Skip to content

Default cell language for native notebooks #14314

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 19 commits into from
Oct 8, 2020

Conversation

DonJayamanne
Copy link

@DonJayamanne DonJayamanne commented Oct 7, 2020

For #13522 , #13520

  • Do not prompt to install ipykernel for non-python kernels
  • Default the cell of the next blank notebook to language of last saved/used notebook.
  • Ability to search for kernels based on language (even if kernel spec is not available)
  • Added Julia language, so users can install this extension and run Julia kernels (remember, they need to select a Jualia language in the cell of a VSCode native editor. However Jualia is not a built in language. Will need to submit a PR upstream).
  • Added tests

Pending

  • CI to install & setup Julia with Github actions.

@DonJayamanne DonJayamanne force-pushed the defaultCellLanguage branch 2 times, most recently from 789c6ac to 640dfab Compare October 7, 2020 22:48
@@ -3344,6 +3344,16 @@
"extensions": [
".ipynb"
]
},
{
"id": "julia",
Copy link
Author

Choose a reason for hiding this comment

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

Julia isn't a built in language in VSCode. We need this if julia users want to use our native notebooks.
All we're doing here is registering a language that will appear in the languages dropdown.

);
// If we do not have kernel spec metadata, but have the language name, then use that to find a kernel
// Else use the kernel spec metadata.
const query =
Copy link
Author

Choose a reason for hiding this comment

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

Support for searching for a kernel based on langauge.
When creating blank notebooks, ipynb metadata will be empty (we cannot pre-emptively add metadata when all we know is the language of the cell).
Rules here #13522 , #13520

/**
* Responsible for determining the default language of a cell for new notebooks.
* It should not always be `Python`, not all data scientists or users of notebooks use Python.
*/
Copy link
Author

Choose a reason for hiding this comment

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

Rules here #13522 , #13520

// THe problem is we need to overide this behavior, however the overriding doesn't work in JS
// as some of the dependencies passed as ctor arguments are not available in the ctor.
// E.g. in the ctor of the base class, the private members (passed as ctor ares) initialized in child class are not available (unlike other languages).
if (initializeJsonIfRequired) {
Copy link
Author

Choose a reason for hiding this comment

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

Interesting behaviour with inheritance & ctors in Js, not the same in other laguages.
Solved by passing an argument.

interpreter
};
// Install missing depednencies only if we're dealing with a Python kernel.
if (interpreter && isPythonKernelConnection(connectionInfo)) {
Copy link
Author

Choose a reason for hiding this comment

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

This was incorrect.
If we're running a Julia kernel, we're prompting the user to install ipykernel.
The tests we have should catch any issues here.

@DonJayamanne DonJayamanne marked this pull request as ready for review October 8, 2020 17:46
@codecov-io
Copy link

codecov-io commented Oct 8, 2020

Codecov Report

Merging #14314 into main will decrease coverage by 0.48%.
The diff coverage is 45.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #14314      +/-   ##
==========================================
- Coverage   59.91%   59.43%   -0.49%     
==========================================
  Files         709      716       +7     
  Lines       39334    39987     +653     
  Branches     5698     5795      +97     
==========================================
+ Hits        23567    23765     +198     
- Misses      14529    14965     +436     
- Partials     1238     1257      +19     
Impacted Files Coverage Δ
src/client/common/application/notebook.ts 10.52% <0.00%> (-0.39%) ⬇️
src/client/common/application/types.ts 100.00% <ø> (ø)
src/client/datascience/baseJupyterSession.ts 56.30% <0.00%> (-1.04%) ⬇️
src/client/datascience/jupyter/jupyterNotebook.ts 4.20% <0.00%> (-0.02%) ⬇️
src/client/datascience/jupyter/kernels/types.ts 25.00% <ø> (ø)
...ascience/jupyter/liveshare/guestJupyterNotebook.ts 8.96% <0.00%> (-0.33%) ⬇️
src/client/datascience/kernel-launcher/types.ts 23.07% <ø> (ø)
src/client/datascience/notebook/notebookEditor.ts 5.71% <0.00%> (ø)
...science/notebookStorage/notebookStorageProvider.ts 50.74% <0.00%> (ø)
src/client/datascience/types.ts 100.00% <ø> (ø)
... and 26 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 8b8fbbf...6fbe468. Read the comment docs.

@DonJayamanne DonJayamanne added the no-changelog No news entry required label Oct 8, 2020
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 8, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@DonJayamanne DonJayamanne merged commit 4ada810 into microsoft:main Oct 8, 2020
@DonJayamanne DonJayamanne deleted the defaultCellLanguage branch October 8, 2020 22:45
luabud pushed a commit to luabud/vscode-python that referenced this pull request Oct 26, 2020
For #13522 , #13520

* Do not prompt to install ipykernel for non-python kernels
* Default the cell of the next blank notebook to language of last saved/used notebook.
* Ability to search for kernels based on language (even if kernel spec is not available)
* Added Julia language, so users can install this extension and run Julia kernels (remember, they need to select a `Jualia` language in the cell of a VSCode native editor. However Jualia is not a built in language. Will need to submit a PR upstream).
* Added tests
DonJayamanne added a commit that referenced this pull request Oct 30, 2020
* Remove cell index property and use build in prop (#14239)
* Update other cells in cell execution (#14240)
* Tests for prompting to install missing ipykernel (#14266)
* Treat Native notebook tests as VS Code tests (#14282)
* Fixes to blowing away of kernel info & not using right startup info (… …
* Default cell language for native notebooks (#14314)
* Ignore formatting in ipynb when dealing with trust (#14333)
* Fixes to trust service (#14352)
* Change `IPython kernel` to `Jupyter kernel` (#14375)
* Trust for native notebooks (#14353)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog No news entry required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants