pyo3-built
Simple macro to expose metadata obtained with the built
crate as a PyDict
Usage
Add the following to your Cargo.toml manifest:
[]
= { = "0.4", = ["chrono"] }
[]
= "0.4"
Create your build.rs as you normally would with built, but activate
dependencies metadata as well:
//! build.rs
extern crate built;
Then, include the generated file anywhere in a dedicated module in your Python
extension, and use the pyo3_built! macro to generate the PyDict:
//! lib.rs
extern crate pyo3_built;
extern crate pyo3;
use *;
/// Module documentation string
That's it ! After compiling your extension module, the __build__ attribute
will contain the following metadata:
>>>
>>>
Customization
When invoking the macro, one can control what will be added to the build dictionary by postfixing the list of the parameters we want in the dictionary. See the following example:
m.add?;
The following parameters are available (they mirror built categories):
"build""time""deps""features""host""target""git"
The corresponding options must be enabled in the built crate and the build.rs for this to work.
By default everything except "git" is enabled.