40 releases (23 breaking)

0.24.6 May 5, 2024
0.24.5 Mar 24, 2024
0.24.3 Nov 5, 2023
0.23.0 Apr 27, 2023
0.7.1 Jul 14, 2021

#4 in #interpret

Download history 33/week @ 2024-02-12 46/week @ 2024-02-19 80/week @ 2024-02-26 43/week @ 2024-03-04 61/week @ 2024-03-11 240/week @ 2024-03-18 189/week @ 2024-03-25 102/week @ 2024-04-01 64/week @ 2024-04-08 29/week @ 2024-04-15 38/week @ 2024-04-22 228/week @ 2024-04-29 162/week @ 2024-05-06 69/week @ 2024-05-13 75/week @ 2024-05-20 56/week @ 2024-05-27

559 downloads per month
Used in irust

MIT license

80KB
1K SLoC

Rust 1K SLoC // 0.0% comments Python 157 SLoC // 0.0% comments Jupyter Notebooks 30 SLoC

IRust Repl

Repl engine used by IRust to interpret rust code

The core is println!("{:?}", expression) with tricks to conserve variables and context

Example:

use irust_repl::{Repl, ToolChain};

let mut repl = Repl::new(ToolChain::Stable).unwrap();
repl.insert("let a = 5");
assert_eq!(repl.eval("a+a").unwrap().output, "10");

Checkout the examples and tests folders for more info.

Jupyter Kernel

A basic jupyer kernel is provided for demo https://github.com/sigmaSd/IRust/tree/master/crates/irust_repl/irust_kernel, to use it:

Installation

This requires IPython 3.

pip install irust_kernel
python -m irust_kernel.install

To use it, run one of:

jupyter notebook
# In the notebook interface, select IRust from the 'New' menu
jupyter qtconsole --kernel irust
jupyter console --kernel irust

Developement

This requires https://github.com/pypa/flit

To start developping locally use flint install --symlink optionally followed by python -m irust_kernel.install --local-build if there are changes to Re executable

Examples

irust.ipynb (simple showcase) and evcxr.ipynb (showcase of evcxr protocol) are provided as an example

Dependencies

~220–435KB