notebookx
A fast, lightweight notebook conversion library written in Rust with Python bindings.
notebookx is a Rust-based alternative to Python's nbconvert, providing fast notebook conversion between formats like .ipynb and percent format (.pct.py).
Features
- Fast: Written in Rust for maximum performance
- Multiple interfaces: Use as a Rust library, CLI tool (
nbx), or Python package - Format conversion: Convert between ipynb and percent format
- Notebook cleaning: Strip outputs, execution counts, and metadata for version control
- Cross-platform: Works on Linux, macOS, and Windows
Installation
Python
pip install notebookx-py
Rust
Add to your Cargo.toml:
[dependencies]
notebookx = "0.1"
CLI
cargo install notebookx --features cli
Usage
Python
from notebookx import Notebook, Format, CleanOptions
# Load a notebook
nb = Notebook.from_file("example.ipynb")
# Convert to percent format
nb.to_file("example.pct.py")
# Or get as string
percent_content = nb.to_string(Format.Percent)
# Clean notebook for version control
clean_nb = nb.clean(CleanOptions(
remove_outputs=True,
remove_execution_counts=True,
))
clean_nb.to_file("clean.ipynb")
# Convenience functions
from notebookx import convert, clean_notebook
convert("input.ipynb", "output.pct.py")
clean_notebook("notebook.ipynb", remove_outputs=True)
CLI (nbx)
# Convert ipynb to percent format
nbx convert notebook.ipynb --to notebook.pct.py
# Convert percent to ipynb
nbx convert notebook.pct.py --to notebook.ipynb
# Clean a notebook (remove outputs)
nbx clean notebook.ipynb --output clean.ipynb --remove-outputs
# Clean in place
nbx clean notebook.ipynb --in-place --remove-outputs --remove-execution-counts
# Use stdin/stdout
cat notebook.ipynb | nbx convert - --from-fmt ipynb --to - --to-fmt percent
Rust
use notebookx::{Notebook, NotebookFormat, CleanOptions};
// Parse from file
let content = std::fs::read_to_string("example.ipynb")?;
let notebook = NotebookFormat::Ipynb.parse(&content)?;
// Convert to percent format
let percent = NotebookFormat::Percent.serialize(¬ebook)?;
// Clean notebook
let options = CleanOptions {
remove_outputs: true,
remove_execution_counts: true,
..Default::default()
};
let clean = notebook.clean(&options);
// Save to file
let output = NotebookFormat::Ipynb.serialize(&clean)?;
std::fs::write("clean.ipynb", output)?;
Supported Formats
| Format | Extension | Description |
|---|---|---|
| ipynb | .ipynb |
Standard Jupyter notebook format (JSON) |
| percent | .pct.py |
Percent format used by Jupytext, VSCode, etc. |
Clean Options
When cleaning notebooks, you can control what gets removed:
| Option | Description |
|---|---|
remove_outputs |
Remove all cell outputs |
remove_execution_counts |
Reset execution counts to null |
remove_cell_metadata |
Remove cell-level metadata |
remove_notebook_metadata |
Remove notebook-level metadata |
remove_kernel_info |
Remove kernel specification |
preserve_cell_ids |
Keep cell IDs (default: regenerate) |
remove_output_metadata |
Remove metadata from outputs |
remove_output_execution_counts |
Remove execution counts from outputs |
Presets
Python:
# For version control (removes cell metadata, execution counts, and output metadata)
# Preserves outputs so rendered content remains visible
options = CleanOptions.for_vcs()
# Strip everything (including outputs)
options = CleanOptions.strip_all()
CLI Reference
nbx convert
Convert notebooks between formats.
nbx convert <INPUT> --to <OUTPUT> [OPTIONS]
Options:
--from-fmt <FORMAT> Input format (ipynb, percent). Inferred from extension if not specified.
--to-fmt <FORMAT> Output format (ipynb, percent). Inferred from extension if not specified.
-h, --help Print help
nbx clean
Clean notebooks by removing outputs and metadata.
nbx clean <INPUT> [OPTIONS]
Options:
-o, --output <FILE> Output file (default: stdout)
-i, --in-place Modify file in place
-O, --remove-outputs Remove all outputs
-e, --remove-execution-counts Remove execution counts
--remove-cell-metadata Remove cell metadata
--remove-notebook-metadata Remove notebook metadata
--remove-kernel-info Remove kernel specification
-h, --help Print help
Development
Building from source
# Clone the repository
git clone https://github.com/lukastk/notebookx.git
cd notebookx
# Build Rust library and CLI
cargo build --release
# Build Python package
pip install maturin
maturin develop
Running tests
# Rust tests
cargo test --workspace
# Python tests
pytest tests/python
License
MIT
Acknowledgements
Example notebooks in nb_format_examples/ are from the Jupytext demo.
Metadata
Release files for notebookx-py 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| notebookx_py-0.1.8.tar.gz | 40.1 kB | With provenance | Details for notebookx_py-0.1.8.tar.gz |
Built distributions (wheels)
Total release size: 5.3 MB
Release files / notebookx_py-0.1.8.tar.gz
| Download URL | notebookx_py-0.1.8.tar.gz |
|---|---|
| Size | 40.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cee26716a9436b7ee0771ec840c49d268068d1e7688b9a4d3da79c763cd07a11
|
|
BLAKE2b-256 checksum How to use checksums |
5f8fa052edfbddf51d4ec485bf05ec0b526fc9d4d476cbdea01b60a040b4dd4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 22, 2026.
Transparency logRelease files / notebookx_py-0.1.8-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | notebookx_py-0.1.8-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 781.2 kB |
| Tags | Linux glibc 2.17+ ARM64 PyPy 3.10 PyPy 3.10 7.3 |
|
SHA-256 checksum How to use checksums |
a90b81f3a2cf8c237749f58b8efd2106311a4be119c69749e4e39417b166c4df
|
|
BLAKE2b-256 checksum How to use checksums |
17dc7d2319a51c392aaa4af91b23e4e9dec2dc7fb77f9ce6dc3070b5a20ae89a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 22, 2026.
Transparency logRelease files / notebookx_py-0.1.8-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | notebookx_py-0.1.8-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 782.4 kB |
| Tags | Linux glibc 2.17+ ARM64 PyPy 3.9 PyPy 3.9 7.3 |
|
SHA-256 checksum How to use checksums |
2d332e959fb4b058962857fbd266d22b80291e2385208cb5f103a59bf257d4c6
|
|
BLAKE2b-256 checksum How to use checksums |
10f3ebe7aba2feec9ac39c6efc6150efe29fbc9db4cd2cd37f69a67e8b974a3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 22, 2026.
Transparency logRelease files / notebookx_py-0.1.8-cp38-abi3-win_amd64.whl
| Download URL | notebookx_py-0.1.8-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 624.6 kB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
fa4d013e4272d3ae714d5ca2206db9d263f85064ecb7380ee7bf722dee5d4625
|
|
BLAKE2b-256 checksum How to use checksums |
070d266611c951bea05711a2bf4791b035720a9daec1181d46589acc57d9f38c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 22, 2026.
Transparency logRelease files / notebookx_py-0.1.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | notebookx_py-0.1.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 806.9 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
5d34febdababaec0b5fca2355d3dbd6f69c3b0b596b26daec5ffa66c754bda94
|
|
BLAKE2b-256 checksum How to use checksums |
baf3b97946c846113f86537e202679d3322e06f5014d86e06fe061767d1cafd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 22, 2026.
Transparency logRelease files / notebookx_py-0.1.8-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | notebookx_py-0.1.8-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 782.2 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
6ae180b4ef7939b4567ca97e60c23acac79e5c17d66ccbca51f1b4faa72ed35a
|
|
BLAKE2b-256 checksum How to use checksums |
89ed7141c4baf3ef1d0ee80bd18b0c6c5b1ee45d6320c86c5c850fd2ab1d8d35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 22, 2026.
Transparency logRelease files / notebookx_py-0.1.8-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | notebookx_py-0.1.8-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 732.6 kB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6adfd281c4c4c4a6dea7ae9e9c5ed4e04359a1425a78d9e33acdd3914c579752
|
|
BLAKE2b-256 checksum How to use checksums |
5478a43c065515b8a26a36e1b1ce96f15b166e4c5beb4d026317adc6db86074f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 22, 2026.
Transparency logRelease files / notebookx_py-0.1.8-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | notebookx_py-0.1.8-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 762.0 kB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
e30a0677f752acaa47bbee12f00b6a3a9caf48e1b10637699dc956c99dbcf17e
|
|
BLAKE2b-256 checksum How to use checksums |
d424f1d34cf2dca8ad9c008345d6900460991535e9b708979a39e6c6df8580a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 22, 2026.
Transparency logSecurity for notebookx-py 0.1.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 8 files in this release have been uploaded with provenance metadata.
Attestation for notebookx_py-0.1.8.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.