bazelbuild / bazelbuild/rules_rust

Linking against python for tests that depend on a pyo3_extension

Open
#3,889 3 comments 0 reactions 0 assignees View on GitHub
awaiting-response pyo3
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

We have a [pyo3_extension](https://bazelbuild.github.io/rules_rust/rust_pyo3.html#pyo3_extension) target which builds a python extension module. As I understand it, this builds as if the `extension-module` feature is enabled so that the library does not link against python. But in some tests we would like to link against libpython so that tests can use pyo3 features such as `PyResult`. Is there any documentation about how to do this with rules_rust? In cargo we can disable the `extension-module` feature when running tests and everything works as expected. Is there a dependency I can get from a rules_python toolchain for example to link libpython into a particular rust_test target?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.