Skip to content

uv add silently ignores --editable when used with a Git/VCS dependency #10992

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

Closed
edmorley opened this issue Jan 27, 2025 · 1 comment · Fixed by #10994
Closed

uv add silently ignores --editable when used with a Git/VCS dependency #10992

edmorley opened this issue Jan 27, 2025 · 1 comment · Fixed by #10994
Assignees
Labels
bug Something isn't working

Comments

@edmorley
Copy link
Contributor

edmorley commented Jan 27, 2025

Summary

Hi

Currently uv add will silently drop the --editable option when used with a VCS URL, rather than warning or erroring about it not being supported.

This is low priority - I just happened to spot it as part of porting some of our existing pip/Poetry/Pipenv tests to uv.

Steps

  1. uv init testcase && cd $_ && uv add --editable 'git+https://github.com/benoitc/gunicorn'
  2. rg git pyproject.toml

Actual

uv add silently ignores --editable and adds the dependency to [tool.uv.sources] in pyproject.toml without the editable = true:

$ uv init testcase && cd $_ && uv add --editable 'git+https://github.com/benoitc/gunicorn'
Initialized project `testcase` at `/Users/emorley/src/testcase`
Using CPython 3.12.8 interpreter at: /opt/homebrew/opt/[email protected]/bin/python3.12
Creating virtual environment at: .venv
Resolved 3 packages in 59ms
Installed 2 packages in 3ms
 + gunicorn==23.0.0 (from git+https://github.com/benoitc/gunicorn@bacbf8aa5152b94e44aa5d2a94aeaf0318a85248)
 + packaging==24.2

$ rg git pyproject.toml
12:gunicorn = { git = "https://github.com/benoitc/gunicorn" }

I checked the docs here but they don't mention that editable mode isn't supported for VCS/Git dependencies:
https://docs.astral.sh/uv/concepts/projects/dependencies/#editable-dependencies
https://docs.astral.sh/uv/reference/cli/#uv-add

I only found out it wasn't supported by manually adding editable = true to the gunicorn entry in [tool.uv.sources], which then resulted in this error:

error: Failed to parse: `pyproject.toml`
  Caused by: TOML parse error at line 12, column 12
   |
12 | gunicorn = { git = "https://github.com/benoitc/gunicorn", editable = true }
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cannot specify both `git` and `editable`

After some GitHub issue searching I found this which suggests this combination is intentionally not supported (which makes sense; it is a bit of a counter-intuitive combination):
#5442

Expected

One of:

  • uv add to fail, with an error message saying ~"--editable cannot be used with VCS/Git dependencies"
  • uv add to succeed, and omit the editable = true from the entry added to [tool.uv.sources], but emit a warning saying ~"ignoring --editable since it's not supported when using VCS/Git dependencies"

For example, when using the uv pip interface, an error message is given:

$ uv pip install -e 'git+https://github.com/benoitc/gunicorn'
error: Editable must refer to a local directory, not a Git URL: `git+https://github.com/benoitc/gunicorn`

It would also be good to document that editable is only supported for path dependencies, at:
https://docs.astral.sh/uv/concepts/projects/dependencies/#editable-dependencies
https://docs.astral.sh/uv/reference/cli/#uv-add
https://docs.astral.sh/uv/pip/packages/#editable-packages

Plus it looks like this difference between pip and uv pip is missing from:
https://docs.astral.sh/uv/pip/compatibility/

Context

I'm writing initial testcases for our support of uv, based on those I have already for our pip/Poetry/Pipenv support - one of which tests editable VCS installations, since:

  • editable installs are particularly tricky in our legacy build system (since the builds occur at one path and then the assets replayed from another at app boot), so we have to perform path rewriting of eg .pth files, which has been known to need adjustments across package manager and/or setuptools version changes, so I'm extra cautious with testing
  • the other package managers support the editable-VCS combination. (I personally think it's a combination that perhaps doesn't make sense when using a lockfile/managed environment, so it's fine to me if uv doesn't support it fwiw. And if uv doesn't support it, then I don't need tests for it etc.)

Platform

macOS 15.2 ARM

Version

uv 0.5.24 (Homebrew 2025-01-23)

Python version

3.12.8

@edmorley edmorley added the bug Something isn't working label Jan 27, 2025
@charliermarsh
Copy link
Member

Thanks!

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