#python #build-script #information #distribution #flags #interface #binary

build python-config-rs

Python distribution information via python3-config. This crate provides a Rust interface to your system’s Python distribution information. Our goal is for this to be useful in build scripts, or in any application where getting the Python include directories, linker flags, or compile flags is necessary. This crate also provides a reimplementation of python3-config, the script, that can query configuration information about your distribution. The binary only needs a Python interpreter. We show that our binary is API compatible with existing python3-config scripts. See the repsitory for more project information.

3 releases

0.1.2 Feb 3, 2019
0.1.1 Feb 2, 2019
0.1.0 Feb 2, 2019

#513 in Build Utils

Download history 160/week @ 2024-07-26 219/week @ 2024-08-02 253/week @ 2024-08-09 80/week @ 2024-08-16 252/week @ 2024-08-23 176/week @ 2024-08-30 169/week @ 2024-09-06 120/week @ 2024-09-13 272/week @ 2024-09-20 294/week @ 2024-09-27 396/week @ 2024-10-04 186/week @ 2024-10-11 310/week @ 2024-10-18 208/week @ 2024-10-25 258/week @ 2024-11-01 102/week @ 2024-11-08

902 downloads per month
Used in 2 crates

MIT/Apache

24KB
322 lines

python-config-rs

API Documentation

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.

python3-config API compatibility

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.

License

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.

Dependencies

~180KB