Mention export-config feature in the guide.

This commit is contained in:
Ashley Anderson 2022-01-17 20:22:19 -05:00
parent bc356f23e0
commit 6e0a20c8cf
2 changed files with 10 additions and 0 deletions

View file

@ -50,6 +50,8 @@ If you save the above output config from `PYO3_PRINT_CONFIG` to a file, it is po
If your build environment is unusual enough that PyO3's regular configuration detection doesn't work, using a config file like this will give you the flexibility to make PyO3 work for you. To see the full set of options supported, see the documentation for the [`InterpreterConfig` struct](https://docs.rs/pyo3-build-config/{{#PYO3_DOCS_VERSION}}/pyo3_build_config/struct.InterpreterConfig.html).
The `export-config` feature of the `pyo3-build-config` crate also allows these values to be exported for use in other crates, and `pyo3-build-config` offers a funciton for reading them in and constructing an `InterpreterConfig`.
## Building Python extension modules
Python extension modules need to be compiled differently depending on the OS (and architecture) that they are being compiled for. As well as multiple OSes (and architectures), there are also many different Python versions which are actively supported. Packages uploaded to [PyPI](https://pypi.org/) usually want to upload prebuilt "wheels" covering many OS/arch/version combinations so that users on all these different platforms don't have to compile the package themselves. Package vendors can opt-in to the "abi3" limited Python API which allows their wheels to be used on multiple Python versions, reducing the number of wheels they need to compile, but restricts the functionality they can use.

View file

@ -81,6 +81,14 @@ The `resolve-config` feature of the `pyo3-build-config` crate controls whether t
build script automatically resolves a Python interpreter / build configuration. This feature is primarily useful when building PyO3
itself. By default this feature is not enabled, meaning you can freely use `pyo3-build-config` as a standalone library to read or write PyO3 build configuration files or resolve metadata about a Python interpreter.
### `export-config`
The `export-config` feature of the `pyo3-build-config` crate controls whether
that crate exports the build configuration for use in other crates. This
feature may be useful if building an additional dependency that requires access
to the Python interpreter used to build PyO3 itself. This feature should be
used with caution as it can impact build portability.
## Optional Dependencies
These features enable conversions between Python types and types from other Rust crates, enabling easy access to the rest of the Rust ecosystem.