Skip to content
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

Don't pull foreign cargo packages into workspace #2491

Open
charliermarsh opened this issue Mar 16, 2024 · 13 comments
Open

Don't pull foreign cargo packages into workspace #2491

charliermarsh opened this issue Mar 16, 2024 · 13 comments
Labels
upstream An upstream dependency is involved

Comments

@charliermarsh
Copy link
Member

If you do cargo run pip install deptry --no-binary deptry --cache-dir foo from the uv directory:

error: Failed to download distributions
  Caused by: Failed to fetch wheel: deptry==0.14.0
  Caused by: Failed to build: deptry==0.14.0
  Caused by: Build backend failed to build wheel through `build_wheel()` with exit status: 1
--- stdout:
Running `maturin pep517 build-wheel -i /Users/crmarsh/workspace/uv/foo/.tmp9kGP1j/.venv/bin/python --compatibility off`
--- stderr:
error: current package believes it's in a workspace when it's not:
current:   /Users/crmarsh/workspace/uv/foo/built-wheels-v0/pypi/deptry/0.14.0/33SZPLpftp49A7cKw7dAq/deptry-0.14.0.tar.gz/Cargo.toml
workspace: /Users/crmarsh/workspace/uv/Cargo.toml

this may be fixable by adding `foo/built-wheels-v0/pypi/deptry/0.14.0/33SZPLpftp49A7cKw7dAq/deptry-0.14.0.tar.gz` to the `workspace.members` array of the manifest located at: /Users/crmarsh/workspace/uv/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: command ['maturin', 'pep517', 'build-wheel', '-i', '/Users/crmarsh/workspace/uv/foo/.tmp9kGP1j/.venv/bin/python', '--compatibility', 'off'] returned non-zero exit status 1
---

We need a way to "stop" Maturin from thinking it's in a workspace.

@charliermarsh charliermarsh added the bug Something isn't working label Mar 16, 2024
@charliermarsh
Copy link
Member Author

@konstin -- any ideas?

@charliermarsh
Copy link
Member Author

(This is not the cause of #2490.)

@konstin konstin changed the title Enforce build isolation for Maturin-based packages Don't pull foreign cargo packages into workspace Mar 18, 2024
@konstin
Copy link
Member

konstin commented Mar 18, 2024

This is a general cargo behavior,

mkdir bar && cd bar && git clone https://github.com/fpgmaas/deptry && cd deptry && cargo check

fails. There seems to be no way to exclude all packages, i've put a feature request upstream: rust-lang/cargo#13600

@konstin konstin removed their assignment Mar 18, 2024
@charliermarsh
Copy link
Member Author

Yeah we need some sort of isolated flag.

@charliermarsh
Copy link
Member Author

@konstin - I guess we could add an empty workspace = [] to the package we're building if it's not present... but that seems bad.

@konstin
Copy link
Member

konstin commented Mar 18, 2024

Does that affect anyone but us when we're developing and putting the cache inside for the uv checkout?

@charliermarsh
Copy link
Member Author

To be clear, this only affects workflows in which the user puts the cache in the same directory as their project, and their project is a Cargo workspace.

@fcakyon
Copy link

fcakyon commented Aug 21, 2024

what can i do to overcome this error? @charliermarsh

@konstin konstin added upstream An upstream dependency is involved and removed bug Something isn't working labels Aug 22, 2024
@Kludex
Copy link

Kludex commented Sep 5, 2024

We are also interested in this... 😅

@fcakyon
Copy link

fcakyon commented Sep 5, 2024

This issue is the only reason we stopped using uv. Is there any fix available?

@zanieb
Copy link
Member

zanieb commented Sep 5, 2024

Can you share why you're placing the uv cache inside your project?

@fcakyon
Copy link

fcakyon commented Sep 6, 2024

I don't try to do anything specific. I just run 'pip install -r requirements' in uv env and this cargo error raises

@charliermarsh
Copy link
Member Author

Can you share the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream An upstream dependency is involved
Projects
None yet
Development

No branches or pull requests

5 participants