mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-27 18:36:44 +00:00
Move OnceMap into its own crate (#946)
## Summary This is extremely generic (like `WaitMap`), and I want to use it in the cache.
This commit is contained in:
parent
5051b2c004
commit
b8fbd529a1
10 changed files with 39 additions and 11 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
|
@ -1922,6 +1922,14 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once-map"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"rustc-hash",
|
||||
"waitmap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.19.0"
|
||||
|
|
@ -2680,6 +2688,7 @@ dependencies = [
|
|||
"insta",
|
||||
"install-wheel-rs",
|
||||
"itertools 0.12.0",
|
||||
"once-map",
|
||||
"once_cell",
|
||||
"owo-colors",
|
||||
"pep440_rs 0.3.12",
|
||||
|
|
@ -2718,12 +2727,11 @@ version = "0.0.1"
|
|||
dependencies = [
|
||||
"anyhow",
|
||||
"distribution-types",
|
||||
"once-map",
|
||||
"pep508_rs",
|
||||
"puffin-cache",
|
||||
"puffin-interpreter",
|
||||
"rustc-hash",
|
||||
"tokio",
|
||||
"waitmap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@ A `venv` replacement to create virtual environments in Rust.
|
|||
|
||||
Install built distributions (wheels) into a virtual environment.]
|
||||
|
||||
## [once-map](./once-map)
|
||||
|
||||
A [`waitmap`](https://github.com/withoutboats/waitmap)-like concurrent hash map for executing tasks
|
||||
exactly once.
|
||||
|
||||
## [pep440-rs](./pep440-rs)
|
||||
|
||||
Utilities for interacting with Python version numbers and specifiers.
|
||||
|
|
|
|||
17
crates/once-map/Cargo.toml
Normal file
17
crates/once-map/Cargo.toml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[package]
|
||||
name = "once-map"
|
||||
version = "0.0.1"
|
||||
edition = { workspace = true }
|
||||
rust-version = { workspace = true }
|
||||
homepage = { workspace = true }
|
||||
documentation = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
rustc-hash = { workspace = true }
|
||||
waitmap = { workspace = true }
|
||||
|
|
@ -17,6 +17,7 @@ cache-key = { path = "../cache-key" }
|
|||
distribution-filename = { path = "../distribution-filename", features = ["serde"] }
|
||||
distribution-types = { path = "../distribution-types" }
|
||||
install-wheel-rs = { path = "../install-wheel-rs" }
|
||||
once-map = { path = "../once-map" }
|
||||
pep440_rs = { path = "../pep440-rs", features = ["pubgrub"] }
|
||||
pep508_rs = { path = "../pep508-rs" }
|
||||
platform-host = { path = "../platform-host" }
|
||||
|
|
@ -26,9 +27,9 @@ puffin-client = { path = "../puffin-client" }
|
|||
puffin-distribution = { path = "../puffin-distribution" }
|
||||
puffin-git = { path = "../puffin-git" }
|
||||
puffin-interpreter = { path = "../puffin-interpreter" }
|
||||
puffin-warnings = { path = "../puffin-warnings" }
|
||||
puffin-normalize = { path = "../puffin-normalize" }
|
||||
puffin-traits = { path = "../puffin-traits" }
|
||||
puffin-warnings = { path = "../puffin-warnings" }
|
||||
pypi-types = { path = "../pypi-types" }
|
||||
requirements-txt = { path = "../requirements-txt" }
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ use thiserror::Error;
|
|||
use url::Url;
|
||||
|
||||
use distribution_types::{BuiltDist, PathBuiltDist, PathSourceDist, SourceDist};
|
||||
use once_map::OnceMap;
|
||||
use pep440_rs::Version;
|
||||
use pep508_rs::Requirement;
|
||||
use puffin_distribution::DistributionDatabaseError;
|
||||
use puffin_normalize::PackageName;
|
||||
use puffin_traits::OnceMap;
|
||||
|
||||
use crate::candidate_selector::CandidateSelector;
|
||||
use crate::pubgrub::{PubGrubPackage, PubGrubPython, PubGrubReportFormatter};
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ use rustc_hash::FxHashMap;
|
|||
use url::Url;
|
||||
|
||||
use distribution_types::{Dist, DistributionMetadata, LocalEditable, Name, PackageId, Verbatim};
|
||||
use once_map::OnceMap;
|
||||
use pep440_rs::Version;
|
||||
use pep508_rs::VerbatimUrl;
|
||||
use puffin_normalize::{ExtraName, PackageName};
|
||||
use puffin_traits::OnceMap;
|
||||
use pypi_types::{Hashes, Metadata21};
|
||||
|
||||
use crate::pins::FilePins;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ use dashmap::DashMap;
|
|||
use url::Url;
|
||||
|
||||
use distribution_types::PackageId;
|
||||
use once_map::OnceMap;
|
||||
use puffin_normalize::PackageName;
|
||||
use puffin_traits::OnceMap;
|
||||
use pypi_types::Metadata21;
|
||||
|
||||
use crate::version_map::VersionMap;
|
||||
|
|
|
|||
|
|
@ -14,11 +14,10 @@ workspace = true
|
|||
|
||||
[dependencies]
|
||||
distribution-types = { path = "../distribution-types" }
|
||||
once-map = { path = "../once-map" }
|
||||
pep508_rs = { path = "../pep508-rs" }
|
||||
puffin-cache = { path = "../puffin-cache" }
|
||||
puffin-interpreter = { path = "../puffin-interpreter" }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
rustc-hash = { workspace = true }
|
||||
tokio = { workspace = true, features = ["sync"] }
|
||||
waitmap = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -7,13 +7,11 @@ use std::path::{Path, PathBuf};
|
|||
use anyhow::Result;
|
||||
|
||||
use distribution_types::{CachedDist, DistributionId, Resolution};
|
||||
pub use once_map::OnceMap;
|
||||
use once_map::OnceMap;
|
||||
use pep508_rs::Requirement;
|
||||
use puffin_cache::Cache;
|
||||
use puffin_interpreter::{Interpreter, Virtualenv};
|
||||
|
||||
mod once_map;
|
||||
|
||||
/// Avoid cyclic crate dependencies between resolver, installer and builder.
|
||||
///
|
||||
/// To resolve the dependencies of a packages, we may need to build one or more source
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue