REPL
The REPL runs a line, a selection or a block of code in a Jupyter kernel and shows the output right under it. It works in ordinary source files, so there is no notebook to manage.
Install a kernel
Tyrn needs a kernel for each language you want to run. These are supported:
| Language | Kernel |
|---|---|
| Python | ipykernel |
| TypeScript and JavaScript | Deno |
| R | Ark or Xeus-R |
| Julia | The Julia Jupyter kernel |
| Scala | Almond |
Python
Set up a kernel for your current Python:
pip install ipykernelpython -m ipykernel install --userFor a virtual environment or conda environment, activate it first, then install ipykernel and register it with a name:
python -m ipykernel install --user --name myenv --display-name "Python (myenv)"TypeScript with Deno
Install Deno, then:
deno jupyter --installOther languages
Install the kernel following its own instructions, for example Ark for R (ark --install) or Almond for Scala. Language support for R and Julia comes from language extensions.
If you add a kernel while Tyrn is open, run repl: refresh kernelspecs from the command palette.
Run code
Open a file and press ctrl-shift-enter to run the selection, or the current line or block if nothing is selected. The result appears below. ctrl-alt-enter runs without moving to the next block.
The REPL Menu in the editor toolbar has Run Selection (or Run Line), Interrupt, Clear Outputs, Restart Kernel, Shut Down Kernel and View Sessions. The same commands are in the command palette:
repl: clear outputsandrepl: clear current outputrepl: interrupt,repl: restartandrepl: shutdownfor the running kernelrepl: sessionslists running kernels
Cells in a script
Separate cells with # %% in Python, or // %% in TypeScript. Each run executes the code between two markers.
# %% Load dataimport numpy as npdata = np.arange(10)
# %% Plotimport matplotlib.pyplot as pltplt.plot(data)Changing kernels
Tyrn finds kernels for you and lists them in the kernel picker (Select Kernel in the editor toolbar):
- Recommended: the Python environment that matches your active toolchain.
- Python Environments: virtual environments such as venv, Poetry, Pipenv, conda and uv.
- Jupyter Kernels: installed kernelspecs.
- Remote Servers: connected remote Jupyter servers.
An environment without ipykernel is listed with “ipykernel not installed”. Selecting it installs ipykernel into that environment.
When you run code with no choice made, Tyrn picks a kernel in this order:
- A Python environment that matches your active toolchain and has
ipykernel. - The first Python environment with
ipykernel. - A Jupyter kernel that matches the language of the code.
You can override the choice with Select Kernel in the editor toolbar. To set a default per language, use jupyter.kernel_selections:
{ "jupyter": { "kernel_selections": { "python": "conda-env", "typescript": "deno", "javascript": "deno", "r": "ark" } }}The value is the kernelspec name. If jupyter is installed, jupyter kernelspec list shows the names.
Input prompts
When code asks for input, such as Python’s input(), a prompt appears under the output. Type your answer and press enter. Password prompts are masked.
Settings
{ "jupyter": { "enabled": true }, "repl": { "max_columns": 128, "max_lines": 32, "output_max_height_lines": 0, "output_max_width_columns": 0 }}Set jupyter.enabled to false to turn the REPL off. output_max_height_lines and output_max_width_columns limit output size, and 0 means no limit.