This package provides:
This package consumes:
Made for Pulsar!
This package was written specifically for Pulsar and did not exist in the Atom package repository.
Run code interactively with Jupyter kernels. Supports Python, R, JavaScript, and other languages with rich output including plots, images, HTML, and LaTeX.

To install hydrogen-next search for hydrogen-next in the Install pane of the Pulsar settings or run ppm install hydrogen-next. Alternatively, you can run ppm install asiloisad/pulsar-hydrogen-next to install a package directly from the GitHub repository.
Commands available in atom-text-editor:not([mini]):
hydrogen-next:run: Ctrl+Enter run code at cursor,
hydrogen-next:run-and-move-down: Shift+Enter run and move to next block,
hydrogen-next:run-cell: Ctrl+Alt+Enter run current cell,
hydrogen-next:run-cell-and-move-down: Shift+Alt+Enter run cell and move to next,
hydrogen-next:run-all: Ctrl+Shift+Enter run all code in editor,
hydrogen-next:run-all-above: run all code above cursor,
hydrogen-next:run-all-inline: run all code inline, one statement at a time,
hydrogen-next:run-all-above-inline: run all code above cursor inline,
hydrogen-next:run-all-below-inline: run all code below cursor inline,
hydrogen-next:recalculate-all: clear results, restart kernel, run all,
hydrogen-next:recalculate-all-above: clear results, restart kernel, run all above,
hydrogen-next:recalculate-all-inline: clear results, restart kernel, run all inline,
hydrogen-next:recalculate-all-above-inline: clear results, restart kernel, run all above inline,
hydrogen-next:clear-results: Ctrl+Shift+Backspace clear output results,
hydrogen-next:clear-and-restart: clear results and restart kernel,
hydrogen-next:clear-and-center: clear results and center cursor,
hydrogen-next:toggle-output-area: toggle output area mode,
hydrogen-next:start-local-kernel: start a local kernel,
hydrogen-next:connect-to-remote-kernel: connect to a remote kernel via gateway,
hydrogen-next:connect-to-existing-kernel: connect to an existing kernel,
hydrogen-next:interrupt-kernel: interrupt running execution,
hydrogen-next:restart-kernel: restart the kernel,
hydrogen-next:shutdown-kernel: shutdown the kernel,
hydrogen-next:rename-remote-session: rename remote session,
hydrogen-next:disconnect-remote-session: disconnect remote session,
hydrogen-next:update-kernels: refresh available kernels list,
hydrogen-next:add-watch: add watch expression,
hydrogen-next:remove-watch: remove watch expression,
hydrogen-next:toggle-watches: toggle watches panel,
hydrogen-next:toggle-variable-explorer: toggle variable explorer panel,
hydrogen-next:go-to-next-cell: jump to next cell,
hydrogen-next:go-to-previous-cell: jump to previous cell,
hydrogen-next:select-cell: select current cell,
hydrogen-next:select-previous-cell: extend cell selection up,
hydrogen-next:select-next-cell: extend cell selection down,
hydrogen-next:move-cell-up: move cell up,
hydrogen-next:move-cell-down: move cell down,
hydrogen-next:fold-current-cell: fold current cell,
hydrogen-next:fold-all-but-current-cell: fold all cells except current,
hydrogen-next:export-notebook: export editor content to .ipynb.
Commands available in atom-workspace:
hydrogen-next:import-notebook: import a .ipynb notebook,
hydrogen-next:open-examples: open example files,
hydrogen-next:shutdown-all-kernels: shutdown all running kernels,
hydrogen-next:toggle-kernel-monitor: toggle kernel monitor panel,
hydrogen-next:toggle-exec-panel: toggle exec panel,
hydrogen-next:show-inspector: show inspector pane,
hydrogen-next:hide-inspector: hide inspector pane,
hydrogen-next:attach-to-claude: attach code and output to claude-chat,
hydrogen-next:debug-toggle: toggle debug logging,
hydrogen-next:open-jupyter-console: open Jupyter console attached to active kernel in an embedded terminal pane,
hydrogen-next:spawn-jupyter-console: spawn Jupyter console attached to active kernel in a system terminal,
hydrogen-next:copy-jupyter-console-command: copy the Jupyter console command to clipboard.
hydrogen-next requires Jupyter kernels to be installed on your system. A kernel is a language-specific backend that executes your code. You can install kernels for many languages. See the full list of available kernels on the Jupyter wiki.
Python is the most common kernel. Install it with:
pip install ipykernel
python -m ipykernel install --user
To register a kernel from a virtual environment, activate it first and install with a display name:
source myenv/bin/activate # Linux/macOS
myenv\Scripts\activate # Windows
pip install ipykernel
python -m ipykernel install --user --name myenv --display-name "Python (myenv)"
The --name flag sets the kernel directory name (used in magic comments), and --display-name sets the label shown in the kernel picker. Once registered, the kernel remains available even when the venv is not activated, as it points directly to the venv's Python interpreter.
To remove a kernel you no longer need:
jupyter kernelspec uninstall myenv
See the IPython kernel documentation for more details.
Install the IRkernel package from R and register it with Jupyter:
R -e "install.packages('IRkernel'); IRkernel::installspec()"
See the IRkernel documentation for more details.
Several JavaScript runtimes provide Jupyter kernels. For IJavascript:
npm install -g ijavascript
ijsinstall
For Deno, the kernel is built-in:
deno jupyter --install
Install the IJulia package from the Julia REPL:
using Pkg; Pkg.add("IJulia")
To list all installed kernels:
jupyter kernelspec list
For general information on installing and managing kernels, see the Jupyter documentation.
When multiple kernels are available for a language, you can specify which kernel to use with a magic comment <comment>:: kernelname on the first line. The comment character is automatically detected based on the language:
#:: python3
import numpy as np
//:: deno
console.log("Hello from Deno");
Matching rules:
python3 not Python3)jupyter kernelspec list (e.g., python3)Python 3.13)If no match is found, falls back to normal behavior (picker or auto-select).
In the kernel picker, press Ctrl+Enter to insert the selected kernel as a magic comment instead of starting it.
Connect to remote or local Jupyter servers by configuring kernel gateways in settings.
Example of local jupyter server:
jupyter server --ServerApp.token='test123'
In the hydrogen-next settings, add gateway entries as JSON:
[
{
"name": "Local Jupyter",
"options": {
"baseUrl": "http://localhost:8888"
}
}
]
Use Hydrogen: Connect to Remote Kernel command to select a gateway and kernel. After selecting a gateway, you'll be prompted to choose an authentication method:
If you prefer to skip the prompt, you can include the token directly in the gateway config:
[
{
"name": "Local Jupyter",
"options": {
"baseUrl": "http://localhost:8888",
"token": "your-server-token-here"
}
}
]
When you run code without a selection, hydrogen-next intelligently detects what to execute based on cursor position.
(), [], {}| Cursor Position | What Gets Executed |
|---|---|
On def/class line |
Entire function/class (with decorators) |
On @decorator line |
Decorated function/class |
On if/elif/else line |
Entire if-elif-else chain |
On try/except/finally line |
Entire try block |
On for/while line |
Loop with optional else |
On with/match line |
Entire block |
| Inside body | Single line only |
| Cursor Position | What Gets Executed |
|---|---|
On line ending with [, (, { |
Entire bracket block |
On line starting with ], ), } |
Entire bracket block |
| Inside bracket block | Single line only |
# Cursor on "if" → executes entire if-elif-else
if x > 0:
print("positive")
elif x < 0:
print("negative")
else:
print("zero")
# Cursor on "print" inside body → executes only that line
if x > 0:
print("positive") # ← cursor here = single line
# Cursor on "[" → executes entire list
data = [
1,
2,
3,
]
# Cursor on "2," inside list → executes only "2,"
data = [
1,
2, # ← cursor here = single line
3,
]
This allows you to execute entire blocks from control lines, while still being able to inspect individual lines inside bodies.
Click on output results to interact with them:
| Action | Effect |
|---|---|
| Click | Copy to clipboard (image or text) |
| Ctrl+Click (Cmd+Click on macOS) | Open in editor (images open in image-editor) |
Images opened via Ctrl+Click are displayed in the image-editor package with full editing capabilities (zoom, pan, filters, save-as).
Attach a standalone Jupyter console to the active kernel via its connection file. The same kernel that runs your inline code is reused, so variables and state are shared between the console and the editor.
Three commands are available:
hydrogen-next:open-jupyter-console: runs the console in an embedded terminal pane inside Pulsar (requires the terminal package),hydrogen-next:spawn-jupyter-console: opens the system terminal and runs the console there (requires the terminal-spawn package),hydrogen-next:copy-jupyter-console-command: copies the resolved command to the clipboard so you can paste it anywhere (e.g. an SSH session).Only local kernels are supported (remote kernels have no connection file).
The command template is configurable via the Jupyter console command setting. Use {connection-file} as a placeholder for the active kernel's connection file path. Examples:
jupyter console --existing {connection-file} (default),jupyter qtconsole --existing {connection-file},ssh remote 'jupyter console --existing {connection-file}'.hydrogen.providerAllows other packages to interact with Jupyter kernels: execute code, get completions, inspect objects, and monitor kernel state.
In your package.json:
{
"consumedServices": {
"hydrogen.provider": {
"versions": {
"^1.3.0": "consumeHydrogen"
}
}
}
}
In your main module:
module.exports = {
consumeHydrogen(hydrogen) {
this.hydrogen = hydrogen;
},
async example() {
const kernel = this.hydrogen.getActiveKernel();
const result = await kernel.execute("print('Hello')");
console.log(result.status); // 'ok' or 'error'
},
};
| Method | Description |
|---|---|
getActiveKernel() |
Get the kernel for the active editor |
onDidChangeKernel(callback) |
Subscribe to kernel changes |
getCellRange(editor) |
Get the current cell range |
| Method | Description |
|---|---|
execute(code) |
Execute code, returns Promise<{status, outputs, error}> |
executeWithCallback(code, callback) |
Execute with streaming callback |
| Property/Method | Description |
|---|---|
executionState |
Current state: 'idle', 'busy', 'starting' |
executionCount |
Current execution count |
lastExecutionTime |
Last execution time string (e.g., "1.23s") |
onDidChangeExecutionState(callback) |
Subscribe to state changes, returns Disposable |
interrupt() |
Interrupt running execution |
restart([callback]) |
Restart the kernel |
shutdown() |
Shutdown the kernel |
| Method | Description |
|---|---|
complete(code) |
Get completions, returns Promise<{matches, ...}> |
inspect(code, cursorPos) |
Get documentation, returns Promise<{data, found}> |
| Property/Method | Description |
|---|---|
language |
Kernel language (e.g., "python") |
displayName |
Kernel display name (e.g., "Python 3") |
kernelSpec |
Full kernel spec object |
getConnectionFile() |
Path to kernel connection file |
| Method | Description |
|---|---|
onDidDestroy(callback) |
Called when kernel is destroyed |
addMiddleware(middleware) |
Add execution middleware |
async function runCode(hydrogen) {
const kernel = hydrogen.getActiveKernel();
// Simple execution
const result = await kernel.execute("x = 42\nprint(x)");
if (result.status === "ok") {
console.log("Outputs:", result.outputs);
} else {
console.error(`${result.error.ename}: ${result.error.evalue}`);
}
// Monitor state
const disposable = kernel.onDidChangeExecutionState((state) => {
console.log("Kernel state:", state);
});
// Get completions
const completions = await kernel.complete("import nu");
console.log(completions.matches); // ['numpy', 'numbers', ...]
// Cleanup
disposable.dispose();
}
hydrogen-next exposes a shared module that allows dependent packages (like jupyter-next) to reuse kernel management and rendering components.
External packages can register their kernels with hydrogen-next, making them visible to tools like Variable Explorer, Kernel Monitor, and Inspector:
const hydrogen = atom.packages.getLoadedPackage("hydrogen-next");
const shared = require(path.join(hydrogen.path, "lib", "shared"));
// Register a kernel
shared.registerKernel(kernel, filePath, editor, grammar);
// Set as current kernel (for Variable Explorer, etc.)
shared.setCurrentKernel(kernel);
// Unregister on shutdown
shared.unregisterKernel(kernel);
| Category | Exports |
|---|---|
| Kernel | KernelManager, registerKernel, unregisterKernel, setCurrentKernel, getStore |
| Output Rendering | Display, Output, RichMedia, StreamText, KernelOutputError |
| Output Utilities | reduceOutputs, normalizeOutput, getBestMimeType, truncateOutput |
| ANSI Handling | AnsiText, escapeCarriageReturn |
| Timing | formatExecutionTime, createExecutionTimeTracker |
| Utilities | kernelSpecProvidesGrammar, tildify, sanitizeHtml |
Got ideas to make this package better, found a bug, or want to help add new features? Just drop your thoughts on GitHub. Any feedback is welcome!