Skip to main content

jupyterlab-scilab

A JupyterLab extension that registers a real "Scilab" CodeMirror language (text/x-scilab), so Scilab notebooks get correct syntax highlighting in the live editor.

Install

pip install jupyterlab-scilab

or, together with the kernel itself:

pip install scilab-kernel[jupyterlab]

That's it -- it's a "prebuilt" JupyterLab extension, so no jlpm/Node.js step is needed for end users. scilab_kernel picks it up automatically once installed: open a notebook with the Scilab kernel and cells are highlighted. (Requires a scilab_kernel release that includes Calysto/scilab_kernel#58; if you're on an older release, upgrade scilab_kernel first.)

Colors

In light JupyterLab themes the highlighting uses the default colors of the SciNotes (Monaco) light theme: structure keywords, function/endfunction, control words (break, return, ...), % constants, builtin functions, strings, numbers, comments, TODO comments, operators, delimiters, : / $ / ..., and the names and arguments in a function header each have their own color. Dark themes keep JupyterLab's own palette.

Why this exists

JupyterLab has no built-in Scilab CodeMirror mode. The closest built-in one is Octave's (Scilab's syntax being close to Octave/Matlab), but Octave's mode only recognizes % as a line comment -- Scilab uses // -- so comments aren't styled, and JupyterLab's "Toggle Comment" (Ctrl+/) would insert invalid Scilab syntax. This extension replaces that stopgap with a dedicated tokenizer instead (src/mode.ts, a CodeMirror 6 StreamLanguage, the same style as CodeMirror's own legacy Octave/Matlab modes): correct ////* */ comments, correct transpose-vs-string disambiguation (x', [1 2 3]', (a+b)'), and ~2200 keywords/builtins sourced directly from a real Scilab session's own getscilabkeywords() and what() -- not a hand-guessed list.

Status

Published and wired up: scilab_kernel reports codemirror_mode: "scilab" and this extension provides it. Verified end-to-end against a live JupyterLab 4.6 instance, including previously-tricky cases (// comments, transpose after closing brackets, primitives like real/imag/cvode/plot2d2 that Scilab's own getscilabkeywords() doesn't enumerate).

Known gaps, if you'd like to help:

  • The keyword/builtin lists in src/mode.ts are comprehensive but not exhaustive -- Scilab has a very large standard library, and new names turn up as people use it. See the comment at the top of src/mode.ts for how to regenerate them from a Scilab session.
  • No automated syntax tests yet.

Build (for development)

Requires Node.js (18+) in addition to the Python environment JupyterLab is installed in. Not needed just to use the extension -- see Install above.

jlpm install                    # installs the JS dependencies
jlpm build                      # compiles src/ and builds the labextension
pip install -e .                # editable install; hatch-jupyter-builder
                                 # links jupyterlab_scilab/labextension into
                                 # JupyterLab's extension search path
jupyter labextension list       # should now list jupyterlab-scilab

For iterative development, jlpm watch (in one terminal) + jupyter lab --watch (in another) rebuilds on save.

Layout

  • src/mode.ts -- the actual Scilab tokenizer (comments, strings, numbers, keywords, operators).
  • src/index.ts -- the JupyterLab plugin that registers src/mode.ts with IEditorLanguageRegistry.
  • package.json / tsconfig.json -- the JS/TS side of the build.
  • pyproject.toml -- packages the built JS as a pip-installable "prebuilt" JupyterLab extension (hatch-jupyter-builder), so pip install jupyterlab-scilab is enough for end users -- no separate jlpm/Node.js step for them.

Metadata

Release files for jupyterlab-scilab 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jupyterlab-scilab 0.1.2
File Size Uploaded
jupyterlab_scilab-0.1.2.tar.gz 79.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupyterlab-scilab 0.1.2
File Interpreter ABI Platform
jupyterlab_scilab-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 104.4 kB

Release files / jupyterlab_scilab-0.1.2.tar.gz

Download URL jupyterlab_scilab-0.1.2.tar.gz
Size 79.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4b1de82f9c8722c671a061d9fc2ed1aeb1633274a9f818f8cbf29ff9038fa419
BLAKE2b-256 checksum
How to use checksums
399b08bd10745e50b112deab9e73a2e7fd9925461002d4cf051b7b14a7b58d3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / jupyterlab_scilab-0.1.2-py3-none-any.whl

Download URL jupyterlab_scilab-0.1.2-py3-none-any.whl
Size 25.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72f3522347960ab71b15bd68119e630d0d8462feb4bf0e4ef95b3657c3aa4bc2
BLAKE2b-256 checksum
How to use checksums
1ac92bf4c57b6c50812caa57641fcc4220b2203e89b819c238f9c56ce36746d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page