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

uv add adds a depencency even if there is a failure during installation #6486

Closed
tjquillan opened this issue Aug 23, 2024 · 2 comments
Closed
Labels
bug Something isn't working help wanted Contribution especially encouraged

Comments

@tjquillan
Copy link
Contributor

When running uv add fails to install the package, it is still added to the dependency array of pyproject.toml causing future invocations of uv add to fail as well.

Reproduction Steps

  1. Run uv add pytorch in a blank project
  • This will fail notifying you that Exception: You tried to install "pytorch". The package named for PyTorch is "torch"
  1. Observe that the pyproject.toml added it to the dependencies array despite this failure.
  2. When you then attempt to run uv add torch as instructed, it will fail in the same way as pytorch is now in the dependency array.
@charliermarsh
Copy link
Member

I think it probably makes sense to remove the dependency here. We already remove the dependency if resolution failed.

@charliermarsh charliermarsh added help wanted Contribution especially encouraged bug Something isn't working labels Aug 23, 2024
charliermarsh pushed a commit that referenced this issue Aug 23, 2024
## Summary

<!-- What's the purpose of the change? What does it do, and why? -->
This is a attempt at fixing #6486.
It reverts changes made to `pyproject.toml` when sync fails during `uv
add`. This solution felt a little heavy handed and could probably be
improved but it is what happens when locking fails during `uv add` so I
thought it would be a good start.

## Test Plan

<!-- How was it tested? -->

I have added a test case for this to `tests/edit.rs`. It uses
`pytorch==1.0.2` to achieve the desired failure.
@charliermarsh
Copy link
Member

Closed by #6526. Thanks for the contribution.

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

No branches or pull requests

2 participants