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.)
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.tsare 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 ofsrc/mode.tsfor 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 registerssrc/mode.tswithIEditorLanguageRegistry.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), sopip install jupyterlab-scilabis enough for end users -- no separatejlpm/Node.js step for them.
Metadata
Release files for jupyterlab-scilab 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jupyterlab_scilab-0.1.1.tar.gz | 109.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jupyterlab_scilab-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 172.7 kB
Release files / jupyterlab_scilab-0.1.1.tar.gz
| Download URL | jupyterlab_scilab-0.1.1.tar.gz |
|---|---|
| Size | 109.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
243b5d7c0f347544e52869441084ddbdf21fa44032a1fb608e9a542b7a2a2e13
|
|
BLAKE2b-256 checksum How to use checksums |
8811c7f8b1431c22acd7bbbd4aac770b629898a42af2f827f0476c38eef8b0a2
|
| 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.1-py3-none-any.whl
| Download URL | jupyterlab_scilab-0.1.1-py3-none-any.whl |
|---|---|
| Size | 63.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8a168b353e8911a3b4fde4ff2b15ec5fde376d9415bc9c43ea3167e444852c6c
|
|
BLAKE2b-256 checksum How to use checksums |
dd89b792ec3678b19c651aa36a69bdee6666a1d789352e79b59f347344e34178
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|