uv icon indicating copy to clipboard operation
uv copied to clipboard

Don't pull foreign cargo packages into workspace

Open charliermarsh opened this issue 1 year ago • 13 comments

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 avatar Mar 16 '24 18:03 charliermarsh

@konstin -- any ideas?

charliermarsh avatar Mar 16 '24 18:03 charliermarsh

(This is not the cause of #2490.)

charliermarsh avatar Mar 16 '24 18:03 charliermarsh

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: https://github.com/rust-lang/cargo/issues/13600

konstin avatar Mar 18 '24 08:03 konstin

Yeah we need some sort of isolated flag.

charliermarsh avatar Mar 18 '24 13:03 charliermarsh

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

charliermarsh avatar Mar 18 '24 13:03 charliermarsh

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

konstin avatar Mar 18 '24 13:03 konstin

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.

charliermarsh avatar Mar 18 '24 13:03 charliermarsh

what can i do to overcome this error? @charliermarsh

fcakyon avatar Aug 21 '24 22:08 fcakyon