How to ship Rust code that Python depends on?
There are a future Python-oriented feature that we would like, which depend on Rust code. The two I can think of:
- !458
- getting rid of the pure-Python NaiveGraph and replace it with the Rust implementation using in-process gRPC and GraphBuilder
So far, these can be gated behind an extra (eg. swh-graph[rust]
) or separate package so not everyone depends on the Rust code.
However, we still need to find a way to ship this code. A few options:
- have the Rust source code in the sdist, and expect people depending on
swh-graph[rust]
to have their own Rust toolchain installed. - a binary wheel (probably needs to be a separate package if we want it to be optional)
- hosting binaries ourselves, and downloading it during package install (bonus:
setup.py
can auto-detect CPU features and download the most optimized wheel that won't SIGILL)