SciTeX Notebook (scitex-notebook)
Jupyter notebook verification, compilation, and DAG-based conversion to topologically-ordered Python scripts.
Full Documentation · uv pip install scitex-notebook[all]
Problem and Solution
| # | Problem | Solution |
|---|---|---|
| 1 | Cell order lies — on-disk .ipynb cell sequence has no relationship to execution order, so naive jupyter nbconvert produces scripts that don't run |
DAG from timestamps — reconstructs the true execution dependency graph from scitex-clew session timestamps, then emits a topologically-ordered .py or a Mermaid diagram |
| 2 | Silent untracked I/O — scitex.io.save/load calls outside @stx.session leave no reproducibility trail, but nothing warns you |
check_notebook() — scans for untracked I/O and flags cells that bypass session tracking |
| 3 | Exploration vs. production gap — notebooks let you iterate freely, but shipping means rewriting by hand into a clean script | "Do what you want, organize later" — execute cells in any order while exploring; compile_notebook(...).to_script() emits the production-ready DAG-ordered script |
Demo
%%{init: {'flowchart': {'nodeSpacing': 20, 'rankSpacing': 40, 'curve': 'linear'}, 'themeVariables': {'fontSize': '12px'}}}%%
flowchart LR
A["experiment.ipynb"] --> B[parse_notebook]
B --> C[scitex-clew DB timestamps]
C --> D[compile_notebook DAG]
D --> E["to_mermaid()"]
D --> F["to_script() topologically ordered .py"]
Figure 1. Notebook compilation from parse to DAG-ordered script.
Out-of-order cells in the notebook are re-ordered into a runnable script:
$ scitex-notebook compile-notebook experiment.ipynb --format script -o experiment.py
$ python experiment.py # runs cleanly, every time
Installation
uv pip install "scitex-notebook[all]"
Requires Python >= 3.10.
Per-module extras
| Extra | Pulls in |
|---|---|
mcp |
fastmcp server for AI agents |
linter |
IO-call conversion via scitex-dev |
all |
mcp plus linter (recommended) |
dev |
pytest, fastmcp, scitex-dev |
docs |
Sphinx plus theme and myst-parser |
uv pip install "scitex-notebook[mcp]" # MCP server for AI agents
uv pip install "scitex-notebook[linter]" # IO-call conversion
uv pip install -e ".[dev]" # editable install
Architecture
1. Parse and verify
parse reads cells while verify and check scan clew sessions and untracked I/O.
2. Compile and convert
compile builds the timestamp DAG and convert emits topologically-ordered scripts.
3. Serve and extend
mcp_server exposes notebook tools and the IPython magic tracks live cells.
%%{init: {'flowchart': {'nodeSpacing': 20, 'rankSpacing': 40, 'curve': 'linear'}, 'themeVariables': {'fontSize': '12px'}}}%%
flowchart LR
PARSE[parse module] --> VERIFY[verify and check]
VERIFY --> COMPILE[compile DAG]
COMPILE --> CONVERT[convert script]
COMPILE --> MCP[mcp server]
CONVERT --> OUT[runnable outputs]
MCP --> OUT
Figure 2. Module collaboration from parse to served outputs.
Four Interfaces
Python API
import scitex_notebook
cells = scitex_notebook.parse_notebook("experiment.ipynb")
issues = scitex_notebook.check("experiment.ipynb") # untracked IO
results = scitex_notebook.verify("experiment.ipynb") # via clew DB
compiled = scitex_notebook.compile("experiment.ipynb")
print(compiled.to_mermaid()) # Mermaid DAG diagram
print(compiled.to_script()) # DAG-ordered Python script
scitex_notebook.convert(
"experiment.ipynb",
output="experiment.py",
mode="unified", # or "per_cell"
)
CLI
scitex-notebook verify-notebook experiment.ipynb
scitex-notebook check-notebook experiment.ipynb
scitex-notebook compile-notebook experiment.ipynb --format mermaid
scitex-notebook compile-notebook experiment.ipynb --format script -o experiment.py
scitex-notebook convert-notebook experiment.ipynb --mode unified -o experiment.py
scitex-notebook --help-recursive # all commands + flags
scitex-notebook --json verify-notebook exp.ipynb # structured output
MCP Server — for AI Agents
| Tool | Description |
|---|---|
notebook_verify |
Verify clew sessions for a notebook |
notebook_check |
Flag untracked scitex.io calls |
notebook_compile |
Return Mermaid DAG / script / JSON |
notebook_convert |
Convert .ipynb to .py |
notebook_parse_notebook |
Parse .ipynb and return all cells |
notebook_get_code_cells |
Return only code cells |
notebook_get_notebook_name |
Return notebook stem name |
notebook_skills_list |
List bundled skill pages |
notebook_skills_get |
Return a named skill page body |
scitex-notebook mcp start # start stdio server
scitex-notebook mcp list-tools # list available tools
scitex-notebook mcp doctor # verify MCP dependencies
Python API
from scitex_notebook import (
parse_notebook, get_code_cells, get_notebook_name,
compile, convert, verify, check,
)
cells = parse_notebook("experiment.ipynb")
compiled = compile("experiment.ipynb")
print(compiled.to_mermaid()) # Mermaid DAG
print(compiled.to_script()) # Topologically-ordered .py
results = verify("experiment.ipynb")
issues = check("experiment.ipynb")
CLI
scitex-notebook compile-notebook experiment.ipynb # DAG-ordered .py (--format script)
scitex-notebook convert-notebook experiment.ipynb # .ipynb → @stx.session script
scitex-notebook verify-notebook experiment.ipynb # clew session pass/fail
scitex-notebook check-notebook experiment.ipynb # untracked-IO scan
scitex-notebook list-python-apis -vv # public APIs with signatures
scitex-notebook skills list # bundled skill pages
scitex-notebook --help-recursive # full CLI reference
IPython Magic Extension
%load_ext scitex_notebook # one line at the top of any notebook
Once loaded, every executed cell is analysed at runtime:
- Hidden-state leak detection — warns when a cell reads a name not defined by any earlier cell in this run
- Out-of-order execution check — flags non-monotonic
execution_count - Untracked I/O — every
stx.io.save/loadcall is recorded per-cell
Cell metadata (dependencies, warnings, file hashes) is written to the same
Clew store used by @scitex.session and stx.io.
%load_ext scitex_notebook
%unload_ext scitex_notebook
Dependencies
- Required:
scitex-clew— execution-order reconstruction via timestamped sessions. - Optional:
scitex-linter— advanced IO-call rewriting during conversion.
Part of SciTeX
scitex-notebook is part of SciTeX. Install via
the umbrella with pip install scitex[notebook] to use as
scitex.notebook (Python) or scitex notebook ... (CLI).
The SciTeX system follows the Four Freedoms for Research below, inspired by the Free Software Definition:
Four Freedoms for Research
- The freedom to run your research anywhere — your machine, your terms.
- The freedom to study how every step works — from raw data to final manuscript.
- The freedom to redistribute your workflows, not just your papers.
- The freedom to modify any module and share improvements with the community.
AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.
Metadata
Release files for scitex-notebook 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scitex_notebook-0.1.4.tar.gz | 4.6 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scitex_notebook-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.2 MB
Release files / scitex_notebook-0.1.4.tar.gz
| Download URL | scitex_notebook-0.1.4.tar.gz |
|---|---|
| Size | 4.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c96c44a996b56423cb420904d695151141e5f139bc45b2e532d4408cc00294d6
|
|
BLAKE2b-256 checksum How to use checksums |
16c66311ed580fce3f07883756d2596eafb215fbc10fc1b7d2b1e80c77b5b2bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / scitex_notebook-0.1.4-py3-none-any.whl
| Download URL | scitex_notebook-0.1.4-py3-none-any.whl |
|---|---|
| Size | 4.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97efc7734c5710784ab7cad49748174eafab2dc8b6eedddb91239143b679cc22
|
|
BLAKE2b-256 checksum How to use checksums |
0a5f46ebd0d726f1ba4c753de505121e6875d94ecb127f1a8b09c7f518c21338
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|