uv
uv copied to clipboard
Keep editable "." install when locking and syncing
I saw a few other issues tagged with question, so I thought it could be OK so a ask one like this.
I have a codebase with some dependencies and some code. I would like to create a venv where all of that is available.
So far uv works if I do this:
uv pip compile pyproject.toml -o requirements.txt
...
uv pip sync requirements.txt
uv pip install -e .
I would like to not have to run the last command after every sync. How can I somehow specify the editable install of the current project in pyproject?
- In poetry, I used a
packageskey under[tool.poetry]but that is obviously not going to work here. - Adding
"myproject @ ."as a dependency results in arelative path without a working directory: .message fromuv
PS the speed of uv looks absolutely fantastic!
👋 It looks like you're looking for the behavior described in
- https://github.com/astral-sh/uv/pull/1000
Let me know if that works for you!
You mean a dependency like "my-project @ file://."? That also gives the "relative path without a working directory" error
Can you share the full output with the -v flag?
It’s possible that we parse pyproject.toml without passing the relative dir down. I can take a look this week to understand what the correct behavior is and whether we’re matching it.
One option is that you should be able to do my-project @ file://${PROJECT_ROOT}. Do you mind trying that?
my-project @ file://${PROJECT_ROOT}
I then get error: my-project 1 depends on itself
my-project @ file://${PROJECT_ROOT}
I then get
error: my-project 1 depends on itself
Update: that worked when I installed the latest version of uv. Great!
One option is that you should be able to do
my-project @ file://${PROJECT_ROOT}. Do you mind trying that?
Hello! ''my-sub-project @ file://${PROJECT_ROOT}/../relative/path#egg=sub_package'' worked, but only halfway:
error: Distribution not found at: file:///resolved/path%23egg=sub_package
Hi, I am trying out something similar, using ${PROJECT_ROOT} does work but when we have chain of libraries, it doesn't compile, it take relative path of my current project directly even of dependent libraries.
https://stackoverflow.com/questions/78042589/pip-requirements-for-relative-packages
I think we intentionally don't allow relative paths in pyproject.toml because it's not part of the PEP standard, and that file needs to follow standards, whereas requirements.txt is not standardized and already does a few things that don't adhere to them.
my-project @ file://${PROJECT_ROOT} does not install my-project as editable in 0.1.24. It makes a copy. In fact, it seems difficult to ever upgrade it without deleting the .venv. pip compile and pip sync does not change anything
The local project is copied into .venv/lib/python3.10/site-packages and then never changed
You need to install with -e in order to install as editable. For example, “uv pip install -e .”
Yes, that works. Would be nice to somehow specify that the project itself should be installed editable. But maybe the pyproject syntax does not allow this