The python-config-rs
crate gives you the same insight as
the python-config
script bundled with your Python distribution.
The crate is intended for build scripts that need
- the Python include directories
- flags for building / linking Python
- ABI flags used when building your Python installation
- any Python information already provided by
python3-config
use python_config::PythonConfig;
let cfg = PythonConfig::new(); // Python 3 by default
// Print include directories
println!("Includes: {}", cfg.includes().unwrap());
// Print installation prefix
println!("Installation prefix: {}", cfg.prefix().unwrap());
This is Python 3 by default, but we provide a Python 2 interface. Note that the Python 2 interface has gone through significantly less testing.
Based on this library, we also provide a reimplementation
of python3-config
. Our automated tests show equivalence
between our implementation and the normal python3-config
script. The binary is Python 3 only.
The matrix belows shows our current compatibility with
the default python3-config
script based on the platform
and Python distribution. A checkmark '✓' indicates that
our test suite passed. A question mark '?' indicates that
we have not conducted testing with this combination
of host system and Python distribution. An 'X' indicates
that we are not compatible on that system with that
Python distribution.
Python | macOS | Debian Stretch |
---|---|---|
3.5 |
? | ✓ |
3.7 |
✓ | ? |
Some python3-config
implementations return strings of flags
that have more than one space between flags. These types of
inconsistencies are acceptable in our testing.
Licensed under the Apache License, Version 2.0 (LICENSE-APACHE or available here) or the MIT license LICENSE-MIT or available here), at your option. All files in the project may not be copied, modified, or distributed except according to those terms.