mirror of https://github.com/astral-sh/uv
Remove `incompatibilities` from index (#905)
This isn't really part of the "index", it's part of the resolution.
This commit is contained in:
parent
477186dcb3
commit
231686e71b
|
|
@ -752,6 +752,19 @@ dependencies = [
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dashmap"
|
||||||
|
version = "5.5.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"hashbrown 0.14.3",
|
||||||
|
"lock_api",
|
||||||
|
"once_cell",
|
||||||
|
"parking_lot_core 0.9.9",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "data-encoding"
|
name = "data-encoding"
|
||||||
version = "2.5.0"
|
version = "2.5.0"
|
||||||
|
|
@ -2648,6 +2661,7 @@ dependencies = [
|
||||||
"cache-key",
|
"cache-key",
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
|
"dashmap 5.5.3",
|
||||||
"derivative",
|
"derivative",
|
||||||
"distribution-filename",
|
"distribution-filename",
|
||||||
"distribution-types",
|
"distribution-types",
|
||||||
|
|
@ -4110,7 +4124,7 @@ version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "28491611b6b9a0b9f027be139a4be792b13a20780100dd8b054d44dbf596d52b"
|
checksum = "28491611b6b9a0b9f027be139a4be792b13a20780100dd8b054d44dbf596d52b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dashmap",
|
"dashmap 3.11.10",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ chrono = { version = "0.4.31" }
|
||||||
clap = { version = "4.4.13" }
|
clap = { version = "4.4.13" }
|
||||||
configparser = { version = "3.0.4" }
|
configparser = { version = "3.0.4" }
|
||||||
csv = { version = "1.3.0" }
|
csv = { version = "1.3.0" }
|
||||||
|
dashmap = { version = "5.5.3" }
|
||||||
data-encoding = { version = "2.5.0" }
|
data-encoding = { version = "2.5.0" }
|
||||||
derivative = { version = "2.2.0" }
|
derivative = { version = "2.2.0" }
|
||||||
directories = { version = "5.0.1" }
|
directories = { version = "5.0.1" }
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ anyhow = { workspace = true }
|
||||||
bitflags = { workspace = true }
|
bitflags = { workspace = true }
|
||||||
chrono = { workspace = true }
|
chrono = { workspace = true }
|
||||||
clap = { workspace = true, features = ["derive"], optional = true }
|
clap = { workspace = true, features = ["derive"], optional = true }
|
||||||
|
dashmap = { workspace = true }
|
||||||
derivative = { workspace = true }
|
derivative = { workspace = true }
|
||||||
fs-err = { workspace = true, features = ["tokio"] }
|
fs-err = { workspace = true, features = ["tokio"] }
|
||||||
futures = { workspace = true }
|
futures = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use distribution_types::PackageId;
|
use distribution_types::PackageId;
|
||||||
use pep440_rs::VersionSpecifiers;
|
|
||||||
use puffin_normalize::PackageName;
|
use puffin_normalize::PackageName;
|
||||||
use puffin_traits::OnceMap;
|
use puffin_traits::OnceMap;
|
||||||
use pypi_types::Metadata21;
|
use pypi_types::Metadata21;
|
||||||
|
|
@ -18,9 +17,6 @@ pub(crate) struct Index {
|
||||||
/// A map from package ID to metadata for that distribution.
|
/// A map from package ID to metadata for that distribution.
|
||||||
pub(crate) distributions: OnceMap<PackageId, Metadata21>,
|
pub(crate) distributions: OnceMap<PackageId, Metadata21>,
|
||||||
|
|
||||||
/// A map from package ID to required Python version.
|
|
||||||
pub(crate) incompatibilities: OnceMap<PackageId, VersionSpecifiers>,
|
|
||||||
|
|
||||||
/// A map from source URL to precise URL.
|
/// A map from source URL to precise URL.
|
||||||
pub(crate) redirects: OnceMap<Url, Url>,
|
pub(crate) redirects: OnceMap<Url, Url>,
|
||||||
}
|
}
|
||||||
|
|
@ -32,7 +28,6 @@ impl Index {
|
||||||
pub(crate) fn cancel_all(&self) {
|
pub(crate) fn cancel_all(&self) {
|
||||||
self.packages.cancel_all();
|
self.packages.cancel_all();
|
||||||
self.distributions.cancel_all();
|
self.distributions.cancel_all();
|
||||||
self.incompatibilities.cancel_all();
|
|
||||||
self.redirects.cancel_all();
|
self.redirects.cancel_all();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
use dashmap::DashMap;
|
||||||
use futures::channel::mpsc::UnboundedReceiver;
|
use futures::channel::mpsc::UnboundedReceiver;
|
||||||
use futures::{pin_mut, FutureExt, StreamExt};
|
use futures::{pin_mut, FutureExt, StreamExt};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
@ -17,9 +18,10 @@ use url::Url;
|
||||||
|
|
||||||
use distribution_filename::WheelFilename;
|
use distribution_filename::WheelFilename;
|
||||||
use distribution_types::{
|
use distribution_types::{
|
||||||
BuiltDist, Dist, DistributionMetadata, LocalEditable, Name, RemoteSource, SourceDist,
|
BuiltDist, Dist, DistributionMetadata, LocalEditable, Name, PackageId, RemoteSource,
|
||||||
VersionOrUrl,
|
SourceDist, VersionOrUrl,
|
||||||
};
|
};
|
||||||
|
use pep440_rs::VersionSpecifiers;
|
||||||
use pep508_rs::{MarkerEnvironment, Requirement};
|
use pep508_rs::{MarkerEnvironment, Requirement};
|
||||||
use platform_tags::Tags;
|
use platform_tags::Tags;
|
||||||
use puffin_client::RegistryClient;
|
use puffin_client::RegistryClient;
|
||||||
|
|
@ -64,6 +66,7 @@ pub struct Resolver<'a, Provider: ResolverProvider> {
|
||||||
python_requirement: PythonRequirement<'a>,
|
python_requirement: PythonRequirement<'a>,
|
||||||
selector: CandidateSelector,
|
selector: CandidateSelector,
|
||||||
index: Arc<Index>,
|
index: Arc<Index>,
|
||||||
|
incompatibilities: DashMap<PackageId, VersionSpecifiers>,
|
||||||
editables: FxHashMap<PackageName, (LocalEditable, Metadata21)>,
|
editables: FxHashMap<PackageName, (LocalEditable, Metadata21)>,
|
||||||
reporter: Option<Arc<dyn Reporter>>,
|
reporter: Option<Arc<dyn Reporter>>,
|
||||||
provider: Provider,
|
provider: Provider,
|
||||||
|
|
@ -155,6 +158,7 @@ impl<'a, Provider: ResolverProvider> Resolver<'a, Provider> {
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
index: Arc::new(index),
|
index: Arc::new(index),
|
||||||
|
incompatibilities: DashMap::default(),
|
||||||
selector,
|
selector,
|
||||||
allowed_urls,
|
allowed_urls,
|
||||||
project: manifest.project,
|
project: manifest.project,
|
||||||
|
|
@ -492,9 +496,8 @@ impl<'a, Provider: ResolverProvider> Resolver<'a, Provider> {
|
||||||
|
|
||||||
// If the version is incompatible, short-circuit.
|
// If the version is incompatible, short-circuit.
|
||||||
if let Some(requires_python) = candidate.validate(&self.python_requirement) {
|
if let Some(requires_python) = candidate.validate(&self.python_requirement) {
|
||||||
self.index
|
self.incompatibilities
|
||||||
.incompatibilities
|
.insert(candidate.package_id(), requires_python.clone());
|
||||||
.done(candidate.package_id(), requires_python.clone());
|
|
||||||
return Ok(Some(candidate.version().clone()));
|
return Ok(Some(candidate.version().clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -606,7 +609,7 @@ impl<'a, Provider: ResolverProvider> Resolver<'a, Provider> {
|
||||||
|
|
||||||
// If the package is known to be incompatible, return the Python version as an
|
// If the package is known to be incompatible, return the Python version as an
|
||||||
// incompatibility, and skip fetching the metadata.
|
// incompatibility, and skip fetching the metadata.
|
||||||
if let Some(entry) = self.index.incompatibilities.get(&package_id) {
|
if let Some(entry) = self.incompatibilities.get(&package_id) {
|
||||||
let requires_python = entry.value();
|
let requires_python = entry.value();
|
||||||
let version = requires_python
|
let version = requires_python
|
||||||
.iter()
|
.iter()
|
||||||
|
|
@ -765,9 +768,8 @@ impl<'a, Provider: ResolverProvider> Resolver<'a, Provider> {
|
||||||
|
|
||||||
// If the version is incompatible, short-circuit.
|
// If the version is incompatible, short-circuit.
|
||||||
if let Some(requires_python) = candidate.validate(&self.python_requirement) {
|
if let Some(requires_python) = candidate.validate(&self.python_requirement) {
|
||||||
self.index
|
self.incompatibilities
|
||||||
.incompatibilities
|
.insert(candidate.package_id(), requires_python.clone());
|
||||||
.done(candidate.package_id(), requires_python.clone());
|
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue