mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-01 04:17:37 +00:00
Use sets rather than vectors for lockfile requirements (#6107)
## Summary Ensures that `--locked` is robust to reordering and duplicates.
This commit is contained in:
parent
fd0daae969
commit
29179570a1
23 changed files with 500 additions and 349 deletions
|
|
@ -35,7 +35,9 @@ pub enum RequirementError {
|
|||
///
|
||||
/// The main change is using [`RequirementSource`] to represent all supported package sources over
|
||||
/// [`VersionOrUrl`], which collapses all URL sources into a single stringly type.
|
||||
#[derive(Hash, Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
#[derive(
|
||||
Hash, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, serde::Serialize, serde::Deserialize,
|
||||
)]
|
||||
pub struct Requirement {
|
||||
pub name: PackageName,
|
||||
#[serde(skip_serializing_if = "Vec::is_empty", default)]
|
||||
|
|
@ -294,7 +296,9 @@ impl Display for Requirement {
|
|||
/// We store both the parsed fields (such as the plain url and the subdirectory) and the joined
|
||||
/// PEP 508 style url (e.g. `file:///<path>#subdirectory=<subdirectory>`) since we need both in
|
||||
/// different locations.
|
||||
#[derive(Hash, Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
#[derive(
|
||||
Hash, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, serde::Serialize, serde::Deserialize,
|
||||
)]
|
||||
#[serde(try_from = "RequirementSourceWire", into = "RequirementSourceWire")]
|
||||
pub enum RequirementSource {
|
||||
/// The requirement has a version specifier, such as `foo >1,<2`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue