Skip to content

Linking against python for tests that depend on a pyo3_extension #3889

@maffoo

Description

@maffoo

We have a 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions