跳转到主要内容

Jupyter和IPython魔法,用于编译用Rust编写的Python扩展

项目描述

rustimport_jupyter

PyPI - Version PyPI - Python Version

这是一个用于编译用Rust编写的Python扩展的Jupyter和IPython魔法。该项目基于rustimport,并添加了IPython魔法。

安装

  1. 按照Rust的入门指南安装Rust。
  2. 安装包: pip install rustimport_jupyter

使用方法

rustimport_jupyter 在Jupyter笔记本中编译用Rust编写的Python扩展。我们通过在Jupyter笔记本中加载 rustimport_jupyter 扩展来启用此功能

%load_ext rustimport_jupyter

接下来,我们在一个单元格前面加上 %%rustimport 标记来编译它

%%rustimport
use pyo3::prelude::*;

#[pyfunction]
fn square(x: i32) -> i32 {
    x * x
}

笔记本示例

许可证

rustimport_jupyter 使用 MIT 许可协议进行分发。

项目详情


下载文件

下载适用于您平台的项目文件。如果您不确定选择哪一个,请了解有关 安装包 的更多信息。

源代码分发

rustimport_jupyter-0.1.3.tar.gz (11.5 kB 查看哈希值)

上传时间 源代码

构建分发

rustimport_jupyter-0.1.3-py3-none-any.whl (5.0 kB 查看哈希值)

上传时间 Python 3

由以下组织支持