Jupyter and IPython magic for compiling Python extensions written in Rust. This project builds on top of rustimport by adding a IPython magic.
- Install Rust by following Rust's Getting started Guide.
- Install package:
pip install rustimport_jupyter
rustimport_jupyter
compiles Python extensions written in Rust in Jupyter notebooks.
We enable the feature by loading the rustimport_jupyter
extension from within a Jupyter notebook:
%load_ext rustimport_jupyter
Next, we prefix a cell with the %%rustimport
marker to compile it:
%%rustimport
use pyo3::prelude::*;
#[pyfunction]
fn square(x: i32) -> i32 {
x * x
}
- NumPy in Rust - Using
rustimport_jupyter
to write NumPy code in Rust! Run in Google Colab ๐ป - Running in Google Colab - For Google Colab,
rustimport_jupyter
and therust
toolchain needs to be installed first. Run in Google Colab ๐ป. - Polars Expression Plugins - Use
rustimport_jupyter
to quickly iterate on Polars expression plugins. Run in Google Colab ๐ป.
rustimport_jupyter
is distributed under the terms of the MIT license.