You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rustimport was heavily inspired by and is partly based upon [cppimport](https://github.com/tbenthompson/cppimport). Check it out if you're interested in the same functionality for C and C++!
10
+
Arguably the simplest way to use rust from python – no manual compilation step, setup work or binding code required. rustimport provides a simple CLI, makes sure the compiled extension stays up to date with your source code and supports IPython/Jupyter notebooks.
11
+
12
+
<i>rustimport was heavily inspired by and is partly based upon [cppimport](https://github.com/tbenthompson/cppimport). Check it out if you're interested in similar functionality for C and C++!</i>
10
13
11
14
## Installation
12
15
@@ -39,6 +42,8 @@ Hurray, you've called some Rust code from Python using a combination of `rustimp
39
42
40
43
This workflow enables you to edit both Rust files and Python and recompilation happens automatically and transparently! It's also handy for quickly whipping together an optimized version of a slow Python function.
41
44
45
+
## Using the CLI
46
+
42
47
To easily create a new single-file extension (like above), or a complete crate, use the provided tool:
43
48
```bash
44
49
$ python3 -m rustimport new my_single_file_extension.rs
@@ -58,6 +63,8 @@ Hello from my_crate, implemented in Rust!
58
63
59
64
Smooth!
60
65
66
+
The CLI can also be used to pre-compile your rust code for production so you don't have to have the rust toolchain on your production environments – see [below](#usage-in-production) for more.
67
+
61
68
## An explanation
62
69
63
70
Okay, now that I've hopefully convinced you on how exciting this is, let's get into the details of how to do this yourself. First, the comment at top is essential to opt in to rustimport. Don't forget this! (See below for an explanation of why this is necessary.)
0 commit comments