pyo3 uses [cfg(Py_3_6)] etc., which is set in build.rs as println!("cargo:rustc-cfg=Py_3_.... Could this exposed to projects that use pyo3? There is a note in the file about being able to use flags to read these values, but that's left from cpython-rust some time ago and doesn't seem to work.