rustdef
Jupyter extension for jupyter notebooks and rust users.
You can define functions in rust and run them as python functions. This extension is built on PyO3 and maturin.
Examples
Prerequisite
- Python >= 3.7 and pip >= 19.3
- Jupyter notebook
- Rust
- cargo-edit
Install
$ pip install rustdef
Usage
Define rust functions,
%%rustdef
#[pyfunction]
fn my_func(x: i64, y: &str) -> i64 {
println!("{}", y);
x + y.len() as i64
}
Add dependencies, (e.g. num crate)
%rustdef deps add num@0.4.0
Defined dependencies are valid only in the current notebook.
Show dependencies,
%rustdef deps show
num = "0.4.0"
[pyo3]
version = "0.13.2"
features = [ "extension-module",]
pyo3 is included by default.
Develop
How does it work?
Roughly, definitions in rustdef are available in python after the following steps.
- Each rustdef magic cell is populated with the module definition of pyo3
- A new crate is generated for the rustdef cell
- The crate is compiled into a python wheel by
maturin - Install the wheel with
pip - Functions with
#[pyfunction]attributes are exported into the interpreter namespace in notebooks - Ready to call the function in notebooks!
Build
maturin is required.
$ pip install maturin
$ maturin build
$ pip install target/wheels/rustdef-{version}-{python}-{platform}.whl
ToDo
- execute within rustdef cell
- class/module supports
- customizable module name
- use functions defined in another cell
- verbose flag
- serde support
- windows support
Metadata
Release files for rustdef 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 13.6 MB
Release files / rustdef-0.4.0-cp311-cp311-manylinux_2_34_x86_64.whl
| Download URL | rustdef-0.4.0-cp311-cp311-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
665440215993540240240745f2cf34229e4a8373de348a8b3e75946af25cfb33
|
|
BLAKE2b-256 checksum How to use checksums |
fac4685584cfc30926c0c4d79083f07de769dbf42da00eccb5b13ef93c7bf142
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / rustdef-0.4.0-cp311-cp311-macosx_10_7_x86_64.whl
| Download URL | rustdef-0.4.0-cp311-cp311-macosx_10_7_x86_64.whl |
|---|---|
| Size | 855.6 kB |
| Tags | CPython 3.11 macOS 10.7+ x86-64 |
|
SHA-256 checksum How to use checksums |
0c6e5d26bc8b6649720a96353a568c83a7b1b01a7db89938d9f606259c7c6933
|
|
BLAKE2b-256 checksum How to use checksums |
7d0db7a74d4366babda1bbd22aa37bc4de8c1fe56e0f15346edea2c5a0a8ee26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / rustdef-0.4.0-cp310-cp310-manylinux_2_34_x86_64.whl
| Download URL | rustdef-0.4.0-cp310-cp310-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.10 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
2f9037d9dfe0651546ba6841abd7b1e1c127d98153f15f74f4595228f8e36259
|
|
BLAKE2b-256 checksum How to use checksums |
60812c39ab79fdf49a72fc1f74f8701ad038289fa21f5a00e3b006267d60c1d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / rustdef-0.4.0-cp310-cp310-macosx_10_7_x86_64.whl
| Download URL | rustdef-0.4.0-cp310-cp310-macosx_10_7_x86_64.whl |
|---|---|
| Size | 855.6 kB |
| Tags | CPython 3.10 macOS 10.7+ x86-64 |
|
SHA-256 checksum How to use checksums |
fdf49d685023abaa66cd7ee6d8a359f4bd5015a536c67ed1eec5a0420573c282
|
|
BLAKE2b-256 checksum How to use checksums |
97c1b308ac86e8f635134f063b8f87277ecca5d2cc997112648bd02e176300c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / rustdef-0.4.0-cp39-cp39-manylinux_2_34_x86_64.whl
| Download URL | rustdef-0.4.0-cp39-cp39-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.9 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
1ddc9002d95c6f4025115916bd3c619271f193acf70d7ce7177f9e438fbc1f46
|
|
BLAKE2b-256 checksum How to use checksums |
271160f4706289133e6b07cc6848cc9ed709302a356087dde4c4f59cf1d98f24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / rustdef-0.4.0-cp39-cp39-macosx_10_7_x86_64.whl
| Download URL | rustdef-0.4.0-cp39-cp39-macosx_10_7_x86_64.whl |
|---|---|
| Size | 855.6 kB |
| Tags | CPython 3.9 macOS 10.7+ x86-64 |
|
SHA-256 checksum How to use checksums |
589095778f54d2a4002414222597da5649b717a113ae79fed8b83cee2bde4f3e
|
|
BLAKE2b-256 checksum How to use checksums |
4cf03f7f9fca8f1f4b38b0d51b8cffaa5914ea81067bfe21b0a2464eed62ef8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / rustdef-0.4.0-cp38-cp38-manylinux_2_34_x86_64.whl
| Download URL | rustdef-0.4.0-cp38-cp38-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.8 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
a595fbdcae5e8ba9b4c7c62bb3cf6f8bf940dabada189fa024f99fc259dec3fa
|
|
BLAKE2b-256 checksum How to use checksums |
047ed6612e3b6a1bfd4d42ee4b3eac0edc229afd14a0eb5b650352ed81f266a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / rustdef-0.4.0-cp38-cp38-macosx_10_7_x86_64.whl
| Download URL | rustdef-0.4.0-cp38-cp38-macosx_10_7_x86_64.whl |
|---|---|
| Size | 855.3 kB |
| Tags | CPython 3.8 macOS 10.7+ x86-64 |
|
SHA-256 checksum How to use checksums |
2442e568afc416a998be26eed235b513c8ecb4838b9c60bf3564974e516f7ca7
|
|
BLAKE2b-256 checksum How to use checksums |
97fc28e7701052f840911bb648e9bec6f12f80d0895b3ee342a1eb0923ca3203
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / rustdef-0.4.0-cp37-cp37m-manylinux_2_34_x86_64.whl
| Download URL | rustdef-0.4.0-cp37-cp37m-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
7405adc859c907e665db34c3b9f85fc70207baa4eb1880c140207e3fa6278bb5
|
|
BLAKE2b-256 checksum How to use checksums |
c9c892ecddea9b240dcb8921ef9de7d8074ca8e1a8dab46606ce881e97f76e24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / rustdef-0.4.0-cp37-cp37m-macosx_10_7_x86_64.whl
| Download URL | rustdef-0.4.0-cp37-cp37m-macosx_10_7_x86_64.whl |
|---|---|
| Size | 855.2 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64 |
|
SHA-256 checksum How to use checksums |
2aeff62028949b20d93975164e244296f26365a381ae0f7a89328e5ba6352119
|
|
BLAKE2b-256 checksum How to use checksums |
e3e3b99361013af4dbcdfe3a5e7967ca4c62030a9a4122da7377b45dc7e5a535
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Security for rustdef 0.4.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.