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
Setuptools helpers for rust Python extensions implemented with [PyO3](https://github.com/PyO3/pyo3) and [rust-cpython](https://github.com/dgrunwald/rust-cpython).
8
+
Setuptools helpers for Rust Python extensions implemented with [PyO3](https://github.com/PyO3/pyo3) and [rust-cpython](https://github.com/dgrunwald/rust-cpython).
8
9
9
-
Compile and distribute Python extensions written in rust as easily as if
10
+
Compile and distribute Python extensions written in Rust as easily as if
10
11
they were written in C.
11
12
12
13
## Setup
@@ -32,6 +33,9 @@ setup(
32
33
)
33
34
```
34
35
36
+
For a complete reference of the options supported by the `RustExtension` class, see the
This file is required for building source distributions
@@ -129,107 +133,6 @@ You can then upload the `manylinux2014` wheels to pypi using [twine](https://git
129
133
130
134
It is possible to use any of the `manylinux` docker images: `manylinux1`, `manylinux2010` or `manylinux2014`. (Just replace `manylinux2014` in the above instructions with the alternative version you wish to use.)
131
135
132
-
## RustExtension
133
-
134
-
You can define rust extension with RustExtension class:
135
-
136
-
```python
137
-
RustExtension(
138
-
name,
139
-
path="Cargo.toml",
140
-
args=None,
141
-
features=None,
142
-
rustc_flags=None,
143
-
rust_version=None,
144
-
quiet=False,
145
-
debug=None,
146
-
binding=Binding.PyO3,
147
-
strip=Strip.No,
148
-
script=False,
149
-
native=False,
150
-
optional=False,
151
-
py_limited_api=False,
152
-
)
153
-
```
154
-
155
-
The class for creating rust extensions.
156
-
157
-
- param str `name`
158
-
159
-
the full name of the extension, including any packages -- ie.
160
-
*not* a filename or pathname, but Python dotted name. It is
161
-
possible to specify multiple binaries, if extension uses
162
-
Binsing.Exec binding mode. In that case first argument has to be
163
-
dictionary. Keys of the dictionary corresponds to compiled rust
164
-
binaries and values are full name of the executable inside python
165
-
package.
166
-
167
-
- param str `path`
168
-
169
-
path to the Cargo.toml manifest file
170
-
171
-
- param \[str\]`args`
172
-
173
-
a list of extra argumenents to be passed to cargo.
174
-
175
-
- param \[str\]`features`
176
-
177
-
a list of features to also build
178
-
179
-
- param \[str\]`rustc_flags`
180
-
181
-
A list of arguments to pass to rustc, e.g. cargo rustc --features
182
-
\<features\>\<args\> -- \<rustc\_flags\>
183
-
184
-
- param str `rust_version`
185
-
186
-
sematic version of rust compiler version -- for example
187
-
*\>1.14,\<1.16*, default is None
188
-
189
-
- param bool `quiet`
190
-
191
-
Does not echo cargo's output. default is `False`
192
-
193
-
- param bool `debug`
194
-
195
-
Controls whether `--debug` or `--release` is passed to cargo. If set
196
-
to None then build type is auto-detect. Inplace build is debug
197
-
build otherwise release. Default: `None`
198
-
199
-
- param int `binding`
200
-
201
-
Controls which python binding is in use.
202
-
*`Binding.PyO3` uses PyO3
203
-
*`Binding.RustCPython` uses rust-cpython
204
-
*`Binding.NoBinding` uses no binding.
205
-
*`Binding.Exec` build executable.
206
-
207
-
- param int `strip`
208
-
209
-
Strip symbols from final file. Does nothing for debug build.
210
-
*`Strip.No` - do not strip symbols (default)
211
-
*`Strip.Debug` - strip debug symbols
212
-
*`Strip.All` - strip all symbols
213
-
214
-
- param bool `script`
215
-
216
-
Generate console script for executable if `Binding.Exec` is used.
217
-
218
-
- param bool `native`
219
-
220
-
Build extension or executable with "-C target-cpu=native"
221
-
222
-
- param bool `optional`
223
-
224
-
if it is true, a build failure in the extension will not abort the
225
-
build process, but instead simply not install the failing
226
-
extension.
227
-
- param bool `py_limited_api`
228
-
229
-
Same as `py_limited_api` on `setuptools.Extension`. Note that if you
230
-
set this to True, your extension must pass the appropriate feature
231
-
flags to pyo3 (ensuring that `abi3` feature is enabled).
232
-
233
136
## Commands
234
137
235
138
- build - Standard build command builds all rust extensions.
@@ -240,5 +143,5 @@ The class for creating rust extensions.
240
143
extensions.
241
144
- tomlgen\_rust - Automatically generate a Cargo.toml manifest based
0 commit comments