mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-26 20:19:08 +00:00
Allow multiple source entries for each package in tool.uv.sources
(#7745)
## Summary This PR enables users to provide multiple source entries in `tool.uv.sources`, e.g.: ```toml [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: ```txt httpx @ git+https://github.com/encode/httpx@0.27.2 ; sys_platform == 'darwin' httpx @ git+https://github.com/encode/httpx@0.24.1 ; sys_platform == 'linux' ``` We verify (at deserialization time) that the markers are non-overlapping. Closes https://github.com/astral-sh/uv/issues/3397.
This commit is contained in:
parent
71d5661bd8
commit
f67347e72c
17 changed files with 1063 additions and 206 deletions
|
@ -12,7 +12,7 @@ use pep440_rs::VersionSpecifiers;
|
|||
use pep508_rs::PackageName;
|
||||
use pypi_types::VerbatimParsedUrl;
|
||||
use uv_settings::{GlobalOptions, ResolverInstallerOptions};
|
||||
use uv_workspace::pyproject::Source;
|
||||
use uv_workspace::pyproject::Sources;
|
||||
|
||||
static FINDER: LazyLock<Finder> = LazyLock::new(|| Finder::new(b"# /// script"));
|
||||
|
||||
|
@ -193,7 +193,7 @@ pub struct ToolUv {
|
|||
pub globals: GlobalOptions,
|
||||
#[serde(flatten)]
|
||||
pub top_level: ResolverInstallerOptions,
|
||||
pub sources: Option<BTreeMap<PackageName, Source>>,
|
||||
pub sources: Option<BTreeMap<PackageName, Sources>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue