docs.rs failed to build pyo3-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
pyo3-0.21.2
PyO3
Rust bindings for the python interpreter.
- User Guide
- API Documentation
- Cargo package: pyo3
PyO3 is licensed under the Apache-2.0 license. Python is licensed under the Python License.
Supported Python versions:
- Python2.7, Python 3.5 and up
Supported Rust version:
- Rust 1.20.0-nightly or later
- On Windows, we require rustc 1.20.0-nightly
Usage
To use pyo3
, add this to your Cargo.toml
:
[]
= "0.1"
Example program displaying the value of sys.version
:
extern crate pyo3;
use ;
Example library with python bindings:
The following two files will build with cargo build
, and will generate a python-compatible library.
On macOS, you will need to rename the output from *.dylib to *.so.
On Windows, you will need to rename the output from *.dll to *.pyd.
Cargo.toml
:
[]
= "rust2py"
= ["cdylib"]
[]
= "0.1"
= ["extension-module"]
src/lib.rs
extern crate pyo3;
use *;
// add bindings to the generated python module
// N.B: names: "librust2py" must be the name of the `.so` or `.pyd` file
/// This module is implemented in Rust.
// logic implemented as a normal rust function
For setup.py
integration, see setuptools-rust
This is fork of rust-cpython project https://github.com/dgrunwald/rust-cpython