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

--project and lock produces incorrect relative path in lock file #9692

Closed
JamesMTSloan opened this issue Dec 6, 2024 · 1 comment · Fixed by #9709
Closed

--project and lock produces incorrect relative path in lock file #9692

JamesMTSloan opened this issue Dec 6, 2024 · 1 comment · Fixed by #9709
Assignees
Labels
bug Something isn't working

Comments

@JamesMTSloan
Copy link

JamesMTSloan commented Dec 6, 2024

Minimal reproduction

Running in /home/user/projects/uv_test with uv 0.5.6.

mkdir other
mkdir project
cd project
uv init
cd ../other
uv --project ../project/ lock
uv --project ../project/ run python3 hello.py

Gives the following output:

Initialized project `project`
Using CPython 3.10.12 interpreter at: /usr/bin/python3.10
Resolved 1 package in 2ms

Using CPython 3.10.12 interpreter at: /usr/bin/python3.10
Creating virtual environment at: ../project/.venv
error: Failed to generate package metadata for `project==0.1.0 @ virtual+../../../project`
  Caused by: Distribution not found at: file:///home/user/project

Contents of project/uv.lock:

version = 1
requires-python = ">=3.10"

[[package]]
name = "project"
version = "0.1.0"
source = { virtual = "../../../project" }

The relative path that ends up in the lock file is incorrect. Using --directory instead of --project produces the expected "." path.
Nor is the path produced, "../../../project", the one given as --project - it ends up pointing to a somewhat arbitrary directory and so with some bad luck could produce some very unexpected results if it happens to hit a different valid project. In my case the concrete project is at /home/user/projects/uv_test/project with uv looking in /home/user/project.

To be clear, in my usecase switching to --directory worked. Maybe this is expected behaviour but I am reporting it as it surprised me.

@charliermarsh
Copy link
Member

Might be a bug? I'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants