Wolfram Engine is a great tool that makes Wolfram Language available to researchers and developers. But since Wolfram Engine does not ship with a notebook interface, writing and debugging Wolfram Language code is challenging. Motivated by the idea of making Wolfram Engine easier to work with, I have recently developed a VS Code extension Wolfram Language Notebook; it offers a lightweight notebook interface to wolframscript
:
To use the extension, you need to install Wolfram Engine, or Wolfram Mathematica with wolframscript
(version 12.0 or higher). You are ready to go if you can run wolframscript
from the command line or the shell. If you want to use remote kernel with the extension, you will instead need an ssh client on the local machine, and wolframscript
on the remote machine.
Getting Started
To create a new Wolfram Language notebook, execute Create New Wolfram Language Notebook in the Command Palette, or create a new file with .wlnb
extension.
Execute Manage Kernels command and choose Use wolframscript to add wolframscript
to the kernel configuration and connect to it. The status of the kernel will be shown in the status bar.
Add a code cell, type Wolfram language code in the cell, and evaluate it.
Features
Syntax Highlighting: The notebook highlights Wolfram language syntax, common built-in functions, and full character names, e.g. \[Alpha]
.
Auto-completion and Usages: Auto-completion for built-in functions are provided. Their usage information is displayed when typing and hovering.
Output Renderer: The notebook renders common Wolfram language expressions into HTML for better presentations. Graphics are shown as rasterized images.
Export as Wolfram notebook: The notebooks can be exported as Wolfram notebooks, containing markdown cells, code cells and their outputs.
Remote kernel: When configured, the notebook can establish an ssh connection to the remote machine and launch a kernel on it. Computations are done remotely, but code and outputs are stored locally. See the kernel configuration guide.
How it works & limitations
The interface of Wolfram Language Notebook is based on VS Code Notebook API. The extension launches wolframscript
and connect to the kernel, and it will manage sending and receiving messages from the kernel. On the back-end, a wolfram kernel schedules the computations, which are done by a subkernel.
Currently, the extension has a few notable limitations. First, the notebook interface cannot send interaction made by the user back to the kernel, because the VS Code API for such messaging is yet to be finalized. Interactive interface is expected to be implemented in future versions. Second, the presentation of graphics still needs to be improved. Instead of bitmaps, vector graphics is a better form in terms of performance and interactability, but such migration will take a long period of time.