Skip to main content

jupyterlab-scilab

A JupyterLab extension that registers a real "Scilab" CodeMirror language (text/x-scilab), instead of scilab_kernel borrowing Octave's mode.

Why this exists

scilab_kernel currently reports codemirror_mode: "octave" as a stopgap (Calysto/scilab_kernel#58), since JupyterLab has no built-in Scilab mode. That gets most tokens (keywords, strings, numbers, operators) highlighted, but Octave's mode only recognizes % as a line comment -- Scilab uses // -- so comments aren't styled and JupyterLab's "Toggle Comment" (Ctrl+/) inserts invalid Scilab syntax.

This extension fixes that by registering a small dedicated tokenizer (src/mode.ts, a CodeMirror 6 StreamLanguage, the same style as CodeMirror's own legacy Octave/Matlab modes) under the mimetype text/x-scilab. Once it's installed, scilab_kernel can go back to reporting codemirror_mode: "scilab" and get this instead of Octave's.

Status

This is a starting point, not a finished extension:

  • The keyword/builtin lists in src/mode.ts are a reasonable first pass, not exhaustive -- Scilab has a very large standard library.
  • No syntax tests yet.
  • Not yet wired up to scilab_kernel (that repo needs codemirror_mode switched from "octave" to "scilab" once this is published).
  • Not built or tested against a real JupyterLab instance yet -- the machine this was scaffolded on has no Node.js installed, only the Python/jlpm side of the JupyterLab toolchain. See "Build" below.

Build

Requires Node.js (18+) in addition to the Python environment JupyterLab is installed in.

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.0

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.0
File Size Uploaded
jupyterlab_scilab-0.1.0.tar.gz 75.3 kB Details

Built distribution (wheel)

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

Total release size: 99.5 kB

Release files / jupyterlab_scilab-0.1.0.tar.gz

Download URL jupyterlab_scilab-0.1.0.tar.gz
Size 75.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d965962c4f6b13c46fda3164e55301016cbf585d615b13d755e90f48ff058846
BLAKE2b-256 checksum
How to use checksums
ee91947f43006a23b8913ff3add4c9440b96c097017c4634eb845f6030012313
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.0-py3-none-any.whl

Download URL jupyterlab_scilab-0.1.0-py3-none-any.whl
Size 24.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47fe7f422bdb0b967000adea9d6af78797b483b2967635e202e33a505965758e
BLAKE2b-256 checksum
How to use checksums
05b56c682b85bfa7806f7786a82b87d3fefa56ca568737f5478ed01ab261216d
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

0.1.2

2 release files

0.1.1

2 release files

This release

0.1.0 This release

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