-
Notifications
You must be signed in to change notification settings - Fork 292
Source Code Organization
The code under src
is partitioned into the following layers
-
platform
: Provides general utilities and infrastructure code/services that can be used in any other layer. -
kernels
: Code related to raw kernel detection, executing kernels and communicating with Jupyter server. -
notebooks
: Code related to VS Code notebook editor/document/controller. It's responsible for integrating Jupyter kernels into.ipynb
notebooks managed by VS Code builtin serializer. -
interactive-window
. Interactive Window specific code. IW is an embed editor which consists of notebook and monaco editors. -
webviews
: Webview based features we offer to users, including Variable view, data viewer, and plot viewer. Each feature has an extension side and webview side. -
standalone
. This is where we host all other standalone features to offer rich Jupyter development experience. Each component is well decoupled, usually has one single responsibility and doesn't affect how the core system functions. Examples include API (expose extensibility points for external partners to interface with), Intellisense (offer rich language features to Jupyter notebook and IW).
To ensure we don't introduce layer breaking changes into the project, we have set up ESLint rules. In a nutshell:
-
platform
can use nothing else -
kernels
can only useplatform
-
notebooks
can only useplatform
andkernels
-
interactive-window
can only useplatform
,notebooks
, andkernels
. Please note thatinteractive-window
knows aboutnotebooks
but not the other way around. Innotebooks
land,interactive-window
is seen as an embed notebook. -
webviews
can depend all components, exceptstandalone
. -
standalone
can depend all others, but no one can depend onstandalone
.
In addition to these top components, we have three global utilities which are shared by the whole code base and serve as living documents:
-
commands.ts
. Typings for VS Code builtin commands and commands we contribute. -
telemetry.ts
. Typings for all our telemetry events and base utilities for sending telemetry. -
messageTypes.ts
. Typings for messages between extension node code and webview code.
We ship the Jupyter extension to both Desktop (run in nodejs environment) and Web (run in web worker environment). Most code in the project is isomorphic and writing code for only Desktop and Web are exceptions.
To distinguish the environments in the product we build, there are entry files that define all the components which will be included in the environment:
-
src/**/serviceRegistry.node.ts
for desktop features -
src/**/serviceRegistry.web.ts
for web features
We intentionally append env in file extension if the code is not generic/shared. Code that is used only in Web is named as *.web.ts
and code only used in Desktop is named as *.node.ts
. Shared code will not end with *.node.ts
or *.web.ts
.
- Contribution
- Source Code Organization
- Coding Standards
- Profiling
- Coding Guidelines
- Component Governance
- Writing tests
- Kernels
- Intellisense
- Debugging
- IPyWidgets
- Extensibility
- Module Dependencies
- Errors thrown
- Jupyter API
- Variable fetching
- Import / Export
- React Webviews: Variable Viewer, Data Viewer, and Plot Viewer
- FAQ
- Kernel Crashes
- Jupyter issues in the Python Interactive Window or Notebook Editor
- Finding the code that is causing high CPU load in production
- How to install extensions from VSIX when using Remote VS Code
- How to connect to a jupyter server for running code in vscode.dev
- Jupyter Kernels and the Jupyter Extension