-
-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Building sdist fails if a crate in workspace isn't used #2117
Comments
Note that adding the crate to dependencies (even not used) makes it work: pola-rs/polars@5cad69e |
I think we're encountering a similar issue in vortex (https://github.com/spiraldb/vortex). We have a Rust workspace with several crates. Suppose, for example, that we have three crates: a, b, and python. The python crate has some Rust code and some Python code. If I run
This writes an
It seems to me that maturin needs to crawl the dependency tree and include in the sdist every local/workspace crate. If I add
|
@danking do you have a fixed branch/commmit that we can use for repro? |
Hey @messense ! Thanks for the rapid reply! Yes, this branch fails:
I failed to produce a simple example, so it might be that we have something subtly misconfigured. Here's an example of what goes wrong for me:
|
`rye build` failed when it tried to build the sdist to produce a wheel. This failed because some _transitive_ workspace dependencies (e.g. vortex-proto) were not present in the sdist. The root cause appears to be a bug in maturin. I saw [a similar issue on their repo](PyO3/maturin#2117 (comment)). I shared a branch with them that reproduces the behavior. Until this issue is resolved, we can work around it by explicitly depending on every workspace crate. Unrelated to the maturin issue, we also need to propagate the toolchain to the sdist build environment.
`rye build` failed when it tried to build the sdist to produce a wheel. This failed because some _transitive_ workspace dependencies (e.g. vortex-proto) were not present in the sdist. The root cause appears to be a bug in maturin. I saw [a similar issue on their repo](PyO3/maturin#2117 (comment)). I shared a branch with them that reproduces the behavior. Until this issue is resolved, we can work around it by explicitly depending on every workspace crate. Two unrelated issues are also fixed here: 1. We must propagate the Rust toolchain to the sdist build environment. 2. `vortex-bytebool` was misnamed in the root Cargo.toml. I'm not sure why this isn't a problem for other crates?
`rye build` failed when it tried to build the sdist to produce a wheel. This failed because some _transitive_ workspace dependencies (e.g. vortex-proto) were not present in the sdist. The root cause appears to be a bug in maturin. I saw [a similar issue on their repo](PyO3/maturin#2117 (comment)). I shared a branch with them that reproduces the behavior. Until this issue is resolved, we can work around it by explicitly depending on every workspace crate. Two unrelated issues are also fixed here: 1. We must propagate the Rust toolchain to the sdist build environment. 2. `vortex-bytebool` was misnamed in the root Cargo.toml. I'm not sure why this isn't a problem for other crates?
Fixes #695. `rye build` failed when it tried to build the sdist to produce a wheel. This failed because some _transitive_ workspace dependencies (e.g. vortex-proto) were not present in the sdist. The root cause appears to be a bug in maturin. I saw [a similar issue on their repo](PyO3/maturin#2117 (comment)). I shared a branch with them that reproduces the behavior. Until this issue is resolved, we can work around it by explicitly depending on every workspace crate. Two unrelated issues are also fixed here: 1. We must propagate the Rust toolchain to the sdist build environment. 2. `vortex-bytebool` was misnamed in the root Cargo.toml. I'm not sure why this isn't a problem for other crates?
@danking I think your repro can be fixed by diff --git a/pyvortex/Cargo.toml b/pyvortex/Cargo.toml
index 59b15ef8..80ee2568 100644
--- a/pyvortex/Cargo.toml
+++ b/pyvortex/Cargo.toml
@@ -58,7 +58,7 @@ tokio = { workspace = true, features = ["fs"] }
vortex-alp = { workspace = true }
vortex-array = { workspace = true }
vortex-dict = { workspace = true }
-vortex-dtype = { workspace = true }
+vortex-dtype = { workspace = true, features = ["proto"] }
vortex-error = { workspace = true }
vortex-expr = { workspace = true }
vortex-fastlanes = { workspace = true } the problem is that the optional |
Thanks! Indeed, this change makes the sdist buildable (indeed, vortex-proto is present in the sdist). I'm a bit confused though. I still don't see vortex-proto listed in the dependencies (I don't have a --format, I assume you meant --format-version):
How did this change convince maturin that it needed to grab the vortex-proto directory? |
It changes the output of |
When building sdist, `cargo metadata` command should output all dependencies including optional ones, otherwise the resulting sdist file may not compile when building with optional features activated. Enabling `--all-features` ensure that all optional path dependencies to be packaged into sdist, which should help with #2117.
When building sdist, `cargo metadata` command should output all dependencies including optional ones, otherwise the resulting sdist file may not compile when building with optional features activated. Enabling `--all-features` ensure that all optional path dependencies to be packaged into sdist, which should help with #2117.
When building sdist, `cargo metadata` command should output all dependencies including optional ones, otherwise the resulting sdist file may not compile when building with optional features activated. Enabling `--all-features` ensure that all optional path dependencies to be packaged into sdist, which should help with #2117.
Confirmed that both pola-rs/polars@c0871ef and vortex sdist build fine with #2215. |
Amazing! Thank you kindly @messense! |
Bug Description
We have a crate polars-stream, which is in the workspace but not yet used in the python package of polars. However, having it in the workspace seems to break building the dist.
Your maturin version (
maturin --version
)1.6
Your Python version (
python -V
)unrelated
Your pip version (
pip -V
)unrelated
What bindings you're using
pyo3
Does
cargo build
work?If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash
/
)?Steps to Reproduce
See the failing CI log here: https://github.com/pola-rs/polars/actions/runs/9633112245/job/26567116574
The text was updated successfully, but these errors were encountered: