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

Implement uv add #3959

Closed
charliermarsh opened this issue Jun 1, 2024 · 5 comments
Closed

Implement uv add #3959

charliermarsh opened this issue Jun 1, 2024 · 5 comments
Assignees
Labels
preview Experimental behavior

Comments

@charliermarsh
Copy link
Member

As part of the Project API, we should have native add and remove commands.

@ibraheemdev
Copy link
Member

ibraheemdev commented Jun 11, 2024

#4193 provides the initial implementation. However, there are still some improvements and open questions:

  • Accept unnamed URLs.
  • Support dev dependencies with --dev.
  • Support tool.uv.sources.
  • Editable requirements?
  • Should uv add perform a uv sync? If so, how should it propagate arguments like extras and dev deps?

@charliermarsh
Copy link
Member Author

Also: adding dependencies that are extras.

ibraheemdev added a commit that referenced this issue Jun 11, 2024
## Summary

Basic implementation of `uv add` and `uv remove` that supports writing
PEP508 requirements to `project.dependencies`.

First step for #3959 and
#3960.
@matterhorn103
Copy link

Excited for what's to come! Forgive my curiosity here. :) I almost asked this in #3560, where the differences and potential confusion between the planned commands uv tool add and uv tool install are discussed, but figured it's actually more relevant here.

Are you guys planning on a command that installs packages to the current venv (or system-wide, I guess) independent of a "project"-like setup? I.e. where there is no pyproject.toml present?

uv pip install is brilliant for standard package installation in this manner because of how fast it is, but your intention seems to be for the uv pip stuff to eventually only be a compatibility layer, rather than something that is regularly used.

But at the same time, if my impressions from your comments in various places are correct, a uv install command will be deliberately avoided?

Or will uv add work anyway without either needing a pyproject.toml or creating one?

ibraheemdev added a commit that referenced this issue Jun 14, 2024
## Summary

Support unnamed URL requirements in `uv add`. For example, `uv add
git+https://github.com/pallets/flask`.

Part of #3959.
ibraheemdev added a commit that referenced this issue Jun 14, 2024
## Summary

Support adding/removing dependencies from `tool.uv.dev-dependencies`
with `uv add/remove --dev`.

Part of #3959.
ibraheemdev added a commit that referenced this issue Jun 18, 2024
## Summary

Implements `uv add foo --workspace`, which adds `foo` as a workspace
dependency with the corresponding `tool.uv.sources` entry.

Part of #3959.
ibraheemdev added a commit that referenced this issue Jun 19, 2024
## Summary

After this change, `uv add` will try to use `tool.uv.sources` for all
source requirements. If a source cannot be resolved, i.e. an ambiguous
Git reference is provided, it will error. Git references can be
specified with the `--tag`, `--branch`, or `--rev` arguments. Editables
are also supported with `--editable`.

Users can opt-out of `tool.uv.sources` support with the `--raw` flag,
which will force uv to use `project.dependencies`.

Part of #3959.
@ibraheemdev
Copy link
Member

Opened #4419 and #4418 to track the remaining tasks.

@ibraheemdev
Copy link
Member

@matterhorn103 Yes, the new project APIs are structured specifically around pyproject.toml and uv.lock. The intention is you won't have to deal with lower level operations directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Experimental behavior
Projects
None yet
Development

No branches or pull requests

3 participants