Function pyo3_build_config::use_pyo3_cfgs

source ·
pub fn use_pyo3_cfgs()
Expand description

Adds all the #[cfg] flags to the current compilation.

This should be called from a build script.

The full list of attributes added are the following:

FlagDescription
#[cfg(Py_3_7)], #[cfg(Py_3_8)], #[cfg(Py_3_9)], #[cfg(Py_3_10)]These attributes mark code only for a given Python version and up. For example, #[cfg(Py_3_7)] marks code which can run on Python 3.7 and newer.
#[cfg(Py_LIMITED_API)]This marks code which is run when compiling with PyO3’s abi3 feature enabled.
#[cfg(PyPy)]This marks code which is run when compiling for PyPy.
#[cfg(GraalPy)]This marks code which is run when compiling for GraalPy.

For examples of how to use these attributes, see PyO3’s guide.