VS Code Jupyter extension
Перейти к файлу
Victor-Nicolae Savu 9e143e3621
Ensure exactly once initialization of CommonMessageCoordinator (#4273)
* Ensure exactly once initialization of CommonMessageCoordinator

The CommonMessageCoordinator requires an asynchronous initialization
step. Since constructors cannot return promisses, the initialization is
delegted to the asynchronous method `initialize`.
`WebviewIPyWidgetCoordinator` takes advantage of the two-step creation
(`constructor` + `initialize`) to use the
`CommonMessageCoordinator::postEmitter` member between construction and
initialization.

This pattern requires a few safeguards to ensure correct use of
`CommonMessageCoordinator` instances by preventing prevent accidental
errors such as:
- forgetting to call `initialize`
- calling `initialize` more than once
- using the object before initialization

Use the factory method pattern to create initialized instances of
the CommonMessageCoordinator to ensure the initialization always takes
place. Make the `initialize`method private to avoid double
initialization.

Allow the caller to customize the internal `postEmitter` (an
instance of `EventEmitter<{message: string; payload: any}>`) through
dependency injection in the  constructor and factory method. This way,
the `WebviewIPyWidgetCoordinator` can interact with the emitter without
waiting for the initialization to finish.

* Race on the newly created CommonMessageCoordinator
2021-01-14 14:46:54 -08:00
.devcontainer Simpler dev container for jupyter extension development (#4318) 2021-01-07 14:14:49 -08:00
.github Use python API to register status bar filter (#4391) 2021-01-14 13:52:13 -08:00
.vscode Fixes to coverage and generate HTML report (#4221) 2021-01-04 11:38:42 -08:00
build Use python API to register status bar filter (#4391) 2021-01-14 13:52:13 -08:00
data Remove unused file (#11766) 2020-05-12 13:09:29 -07:00
docs Add doc dependencies (#425) 2020-11-09 13:46:58 -08:00
images Add Images for ReadMe (#412) 2020-11-06 15:40:04 -08:00
news stop preloading requirejs on ipywidgets (#4345) 2021-01-12 11:44:53 -08:00
pythonFiles Use KernelConnectionMetadata instead of INotebookMetadata where possible (#4322) 2021-01-14 08:15:17 -08:00
resources add run above and run below to native notebooks (#4240) 2020-12-17 16:35:17 -08:00
snippets Remove more unnecessary code (#85) 2020-09-17 14:00:29 -07:00
src Ensure exactly once initialization of CommonMessageCoordinator (#4273) 2021-01-14 14:46:54 -08:00
syntaxes Run prettier on our yaml, json and md files (#10871) 2020-04-01 10:19:44 -07:00
types Fix proposed API changes (#4335) 2021-01-08 15:43:59 -08:00
typings Add tests for run cells above and below in native notebooks (#4314) 2021-01-06 17:59:29 -08:00
.editorconfig
.eslintignore Implement ipywidgets in native notebooks (#1104) 2020-11-13 14:25:54 -08:00
.eslintrc Remove more unnecessary interpreter types (#31) 2020-09-14 14:12:06 -07:00
.gitattributes Update to Jedi 0.17 (#11252) 2020-04-21 10:16:35 -07:00
.gitignore Replace ffi-napi and ref-napi with BCryptGenRandom executable (#4000) 2020-12-07 11:07:32 -08:00
.npmrc Make gather an optional component (#9755) 2020-03-08 10:42:29 -07:00
.nvmrc Make ffi-napi and ref-napi optional dependencies (#3935) 2020-11-16 15:44:05 -08:00
.prettierignore Fix the scoping of our ESLint rules (#13558) 2020-08-25 10:19:48 -07:00
.prettierrc.js Support Update Display Data (#10874) 2020-03-31 11:08:15 -07:00
.sonarcloud.properties Make it possible to use the LSP to talk to Jedi (#13855) 2020-09-10 17:26:42 -07:00
.vscodeignore Replace ffi-napi and ref-napi with BCryptGenRandom executable (#4000) 2020-12-07 11:07:32 -08:00
CHANGELOG.md Merge 2020 Dec Point release into main (#4214) 2020-12-11 12:01:20 -08:00
CODE_OF_CONDUCT.md
CODING_STANDARDS.md Run prettier on our yaml, json and md files (#10871) 2020-04-01 10:19:44 -07:00
CONTRIBUTING.md small name change (#4196) 2020-12-10 08:05:08 -08:00
INTERACTIVE_TROUBLESHOOTING.md More things to be renamed (#114) 2020-09-23 15:48:51 -07:00
LICENSE
README.md Claudiaregio/jupyter read me (#430) 2020-11-11 09:46:17 -08:00
SECURITY.md Run prettier on our yaml, json and md files (#10871) 2020-04-01 10:19:44 -07:00
ThirdPartyNotices-Distribution.txt Include renderer extension output during build steps (#4303) 2021-01-05 17:23:00 -08:00
ThirdPartyNotices-Repository.txt Merge over release changes (#1097) 2020-11-12 15:51:27 -08:00
extension_license.txt Merge over release changes (#1097) 2020-11-12 15:51:27 -08:00
gulpfile.js Last fix for clean just left the directories (#4383) 2021-01-13 15:31:11 -08:00
icon.png Update logo again (#409) 2020-11-05 18:56:35 -08:00
package-lock.json Bump axios via vscode-tas-client (#4305) 2021-01-05 16:55:33 -08:00
package.json remove variable view experiement and enable along with native notebook (#4380) 2021-01-13 14:44:36 -08:00
package.nls.it.json Rename Python to Jupyter & remove unwanted strings/localizations (#267) 2020-10-20 12:53:52 -07:00
package.nls.json Open variables view command and remove the test OPEN button from it (#4319) 2021-01-07 12:54:34 -08:00
package.nls.nl.json Rename Python to Jupyter & remove unwanted strings/localizations (#267) 2020-10-20 12:53:52 -07:00
package.nls.pl.json Rename Python to Jupyter & remove unwanted strings/localizations (#267) 2020-10-20 12:53:52 -07:00
package.nls.ru.json Rename Python to Jupyter & remove unwanted strings/localizations (#267) 2020-10-20 12:53:52 -07:00
package.nls.zh-tw.json Rename Python to Jupyter & remove unwanted strings/localizations (#267) 2020-10-20 12:53:52 -07:00
pvsc.code-workspace Implement ipywidgets in native notebooks (#1104) 2020-11-13 14:25:54 -08:00
requirements.in Bump python-jsonrpc-server from 0.2.0 to 0.4.0 (#19) 2020-09-24 11:04:25 -07:00
requirements.txt Move dependencies from devDependencies (#278) 2020-10-22 12:40:04 -07:00
sprint-planning.github-issues Add a sprint planning issues dashboard (#13028) 2020-07-20 12:23:18 -07:00
tsconfig.datascience-ui.json Fix formatting of json files 2020-02-25 15:21:50 -08:00
tsconfig.extension.json Add compiler support for ES2020 (#13834) 2020-09-09 14:30:24 -07:00
tsconfig.json Fix code coverage at codecov to work (#4207) 2020-12-10 14:49:33 -08:00
tsfmt.json Prettier 2020-02-20 10:45:04 -08:00
tslint.json Remove more unnecessary interpreter types (#31) 2020-09-14 14:12:06 -07:00
vscode-python-signing.csproj

README.md

Jupyter Extension for Visual Studio Code

A Visual Studio Code extension that provides basic notebook support for language kernels that are supported in Jupyter Notebooks today. Many language kernels will work with no modification. To enable advanced features, modifications may be needed in the VS Code language extensions.

Working with Python

Whether you are on VS Code Stable or VS Code Insiders, if you would like to work with Python just make sure you're using the latest version of the Python Extension to enjoy the joint partnership of the Python and Juypter Extensions!

Please follow the Python Extension ReadMe instructions to get started and visit the Python Documentation to learn more about how the Python and Jupyter Extension are working together to provide an optimum Python notebooks experience.

Working with other Languages

The Jupyter Extension supports other languages such as Julia and R (as well as Python) in VS Code Insiders with our new Native Notebooks Experience!

Quick Start

  • Step 1. Install VS Code Insiders

  • Step 2 If not working with Python, make sure to have a Jupyter kernelspec that corresponds to the language you would like to use installed on your machine.

  • Step 3. Install the Jupyter Extension

  • Step 4. Open or create a notebook file and start coding!

  • Special Note: The Jupyter Extension in VS Code Insiders will include our Native Notebooks experience! To opt out:

    • Open the command palette (Windows: Ctrl + Shift + P, iOS: Command + Shift + P) and select "Preferences: Open Settings (JSON)"
    • Add the following code to your JSON settings: "jupyter.experiments.optOutFrom": ["NativeNotebookEditor"],

To use the latest version of the extension:

  • Set the "jupyter.insidersChannel" setting to "daily" or "weekly" based on how often you would like the extension to check for updates

Notebooks Quick Start

  • To create a new notebook open the command palette (Windows: Ctrl + Shift + P, iOS: Command + Shift + P) and select the command "Jupyter: Create New Blank Jupyter Notebook"

  • Select your kernel by clicking on the kernel picker in the bottom right of the status bar or by invoking the "Notebook: Select Notebook Kernel" command.

  • Change the cell language by clicking the language picker or by invoking the "Notebook: Change Cell Language" command.

Useful commands

Open the Command Palette (Command+Shift+P on macOS and Ctrl+Shift+P on Windows/Linux) and type in one of the following commands:

Command Description
Jupyter: Create New Blank Jupyter Notebook Create a new blank Jupyter Notebook
Notebook: Select Notebook Kernel Select or switch kernels within your notebook
Notebook: Change Cell Language Change the language of the cell currently in focus
Jupyter: Export to HTML Jupyter: Export to PDF Create a presentation-friendly version of your notebook in HTML or PDF

To see all available Jupyter Notebook commands, open the Command Palette and type Jupyter or Notebook.

Feature details

Learn more about the rich features of the Jupyter extension:

  • IntelliSense: Edit your code with auto-completion, code navigation, syntax checking and more!

    • May be limited due to kernelspec of choice
  • Jupyter Notebooks: Create and edit Jupyter Notebooks, add and run code/markdown cells, render plots, create presentation-friendly versions of your notebook by exporting to HTML or PDF and more!

Supported locales

The extension is available in multiple languages: de, en, es, fa, fr, it, ja, ko-kr, nl, pl, pt-br, ru, tr, zh-cn, zh-tw

Questions, issues, feature requests, and contributions

  • If you have a question about how to accomplish something with the extension, please ask on Stack Overflow.

  • Any and all feedback is appreciated and welcome! If you come across a problem with the extension, please file an issue.

    • If someone has already filed an issue that encompasses your feedback, please leave a 👍/👎 reaction on the issue.
  • Contributions are always welcome! Please see our contributing guide for more details.

  • If you're interested in the development of the extension, you can read about our development process

Data and telemetry

The Microsoft Jupyter Extension for Visual Studio Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. This extension respects the telemetry.enableTelemetry setting which you can learn more about at https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting.