pyembed/docs/pyembed_building.rst
.. _pyembed_building:
A design goal of pyembed is for it to exist like normal Rust
crates. However, because pyembed needs to link against Python,
there are some special requirements.
pyembed pulls in a Python library link dependency via the pyo3
crate. At cargo build time, pyo3 (technically pyo3-build-config)
will attempt to locate a libpython to link against. This behavior is
documented at https://pyo3.rs/v0.15.0/building_and_distribution.html.
Generally speaking, all the caveats documented by pyo3 apply to
pyembed as well, since this project is a glorified, value-adding
wrapper around pyo3.
The short version of the PyO3 documentation is as follows:
python on
PATH and attempt to derive its build configuration from it.PYO3_PYTHON environment variable.pyo3-build-config
crate and point to it via the PYO3_CONFIG_FILE environment
variable.Generally speaking, if you are able to build the pyo3 crate in
isolation, you should be able to build the pyembed crate. To
customize how the pyembed crate links against Python, use
pyo3's mechanisms for doing that.