setuptools-rust icon indicating copy to clipboard operation
setuptools-rust copied to clipboard

Failiure when building a wheel from a rust crate with a local dependency

Open IBims1NicerTobi opened this issue 8 months ago • 3 comments
trafficstars

I have a rust crate in a workspace with a local dependency. Basically I have

project_workspace_dir
├─project-core
└─project-python

And my project_python depends on project_core in Cargo.toml like this:

[dependencies]
project-core = { path = "../project-core" }

When I call python -m build -s I see the following in my logs:

creating project-0.1.0/../project-core
creating project-0.1.0/../project-core/src

and

copying ../project-core/Cargo.toml -> tr0-0.1.0/../project-core
copying ../project-core/src/error.rs -> tr0-0.1.0/../project-core/src
copying ../project-core/src/lib.rs -> tr0-0.1.0/../project-core/src

This leads to project-core ending up next to dist

IBims1NicerTobi avatar Feb 23 '25 20:02 IBims1NicerTobi

I think the optimal solution here would be to detect local dependencies, actually copy them to the archive and rewrite Cargo.toml for the affected crate, but I'm not sure how reasonable that is.

IBims1NicerTobi avatar Feb 23 '25 20:02 IBims1NicerTobi

MWE here

IBims1NicerTobi avatar Feb 28 '25 17:02 IBims1NicerTobi

I think the optimal solution here would be to detect local dependencies, actually copy them to the archive and rewrite Cargo.toml for the affected crate, but I'm not sure how reasonable that is.

This is implemented in maturin but it introduces some other issues: https://github.com/PyO3/maturin/issues?q=is%3Aissue%20label%3Asdist%20label%3Abug

For simplicity I don't think we should implement it in setuptools-rust.

messense avatar Apr 15 '25 10:04 messense