Skip to content

Allow multiple source entries for each package in tool.uv.sources#7745

Merged
charliermarsh merged 5 commits intomainfrom
charlie/multi-sources
Sep 30, 2024
Merged

Allow multiple source entries for each package in tool.uv.sources#7745
charliermarsh merged 5 commits intomainfrom
charlie/multi-sources

Conversation

@charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Sep 27, 2024

Summary

This PR enables users to provide multiple source entries in tool.uv.sources, e.g.:

[tool.uv.sources]
httpx = [
  { git = "https://github.com/encode/httpx", tag = "0.27.2", marker = "sys_platform == 'darwin'" },
  { git = "https://github.com/encode/httpx", tag = "0.24.1", marker = "sys_platform == 'linux'" },
]

The implementation is relatively straightforward: when we lower the requirement, we now return an iterator rather than a single requirement. In other words, the above is transformed into two requirements:

httpx @ git+https://github.com/encode/[email protected] ; sys_platform == 'darwin'
httpx @ git+https://github.com/encode/[email protected] ; sys_platform == 'linux'

We verify (at deserialization time) that the markers are non-overlapping.

Closes #3397.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accept list of sources with markers in uv.tool.sources

4 participants