You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When building an sdist file, the workspace Cargo.toml file added to the sdist has the workspace.members field conspicuously removed, causing the build of the sdist to fail with the following error:
Running command Preparing metadata (pyproject.toml)
error: current package believes it's in a workspace when it's not:
current: /tmp/pip-req-build-_gj0kdlu/crates/word-count/Cargo.toml
workspace: /tmp/pip-req-build-_gj0kdlu/Cargo.toml
this may be fixable by adding `crates/word-count` to the `workspace.members` array of the manifest located at: /tmp/pip-req-build-_gj0kdlu/Cargo.toml
Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest.
💥 maturin failed
Caused by: Cargo metadata failed. Does your crate compile with `cargo build`?
Caused by: `cargo metadata` exited with an error:
Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/tmp/pip-modern-metadata-niydeb24', '--interpreter', '/usr/bin/python3']' returned non-zero exit status 1.
Checking for Rust toolchain....
Running `maturin pep517 write-dist-info --metadata-directory /tmp/pip-modern-metadata-niydeb24 --interpreter /usr/bin/python3`
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
As best as I can figure out, this is caused by having workspace members in a common subdirectory in the workspace. That is, instead of this structure...
Thanks for the report, unfortuntely I may not have time to look into it this week.
If you feel like to investigate, the relevant code is in mostly in https://github.com/PyO3/maturin/blob/main/src/source_distribution.rs, change the code then run cargo run sdist -m <path to the binding Cargo.toml> -o dist to generate a sdist in $PWD/dist/, unpack it then run maturin build in it to verify the build. Pull requests are welcome!
Bug Description
When building an sdist file, the workspace
Cargo.toml
file added to the sdist has theworkspace.members
field conspicuously removed, causing the build of the sdist to fail with the following error:As best as I can figure out, this is caused by having workspace members in a common subdirectory in the workspace. That is, instead of this structure...
... the workspace looks like this:
If I make the example look like the first file structure, building from the sdist is successful.
Your maturin version (
maturin --version
)1.3.0
Your Python version (
python -V
)3.11.2
Your pip version (
pip -V
)23.0.1
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
README.md
The text was updated successfully, but these errors were encountered: