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

Opt-out tool.uv.sources support for uv add #4406

Merged
merged 6 commits into from
Jun 19, 2024
Merged

Conversation

ibraheemdev
Copy link
Member

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 ibraheemdev added the preview Experimental behavior label Jun 18, 2024
crates/uv/tests/edit.rs Outdated Show resolved Hide resolved
url: url.to_url(),
subdirectory: subdirectory
.map(|path| {
let path = path.to_str().ok_or(SourceError::InvalidPath)?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We normally just do to_string_lossy and skip the error handling

Comment on lines -352 to +520
source = "git+https://github.com/astral-test/uv-public-pypackage?rev=0.0.1#0dacfd662c64cb4ceb16e6cf65a157a8b715b979"
source = "git+https://github.com/astral-test/uv-public-pypackage?tag=0.0.1#0dacfd662c64cb4ceb16e6cf65a157a8b715b979"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd that the lockfile is different, shouldn't we disambiguate before locking (or merge all to rev)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #4417.

@ibraheemdev ibraheemdev merged commit 7b72b55 into main Jun 19, 2024
47 checks passed
@ibraheemdev ibraheemdev deleted the ibraheem/uv-add-sources branch June 19, 2024 18:20
ChannyClaus pushed a commit to ChannyClaus/uv that referenced this pull request Jun 20, 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 astral-sh#3959.
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

Successfully merging this pull request may close these issues.

None yet

3 participants