Skip to content

Commit 22ebf0b

Browse files
committed
Revert build config
1 parent 3059531 commit 22ebf0b

File tree

17 files changed

+28
-158
lines changed

17 files changed

+28
-158
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/install-wheel-rs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "install-wheel-rs"
33
version = "0.0.1"
44
publish = false
5-
description = "Takes a wheel and installs it, either in a venv or for monotrail"
5+
description = "Takes a wheel and installs it."
66
keywords = ["wheel", "python"]
77

88
edition = { workspace = true }

crates/install-wheel-rs/Readme.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

crates/uv-cache-info/src/cache_info.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,28 @@ use std::cmp::max;
66
use std::io;
77
use std::path::{Path, PathBuf};
88

9+
/// The information used to determine whether a built distribution is up-to-date, based on the
10+
/// timestamps of relevant files, the current commit of a repository, etc.
911
#[derive(Default, Debug, Clone, Hash, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
1012
#[serde(rename_all = "kebab-case")]
1113
#[serde(try_from = "CacheInfoWire")]
1214
pub struct CacheInfo {
15+
/// The timestamp of the most recent `ctime` of any relevant files, at the time of the build.
1316
timestamp: Option<Timestamp>,
17+
/// The commit at which the distribution was built.
1418
commit: Option<Commit>,
1519
}
1620

1721
impl CacheInfo {
22+
/// Return the [`CacheInfo`] for a given timestamp.
1823
pub fn from_timestamp(timestamp: Timestamp) -> Self {
1924
Self {
2025
timestamp: Some(timestamp),
2126
..Self::default()
2227
}
2328
}
2429

30+
/// Compute the cache info for a given path, which may be a file or a directory.
2531
pub fn from_path(path: &Path) -> io::Result<Self> {
2632
let metadata = fs_err::metadata(path)?;
2733
if metadata.is_file() {
@@ -31,6 +37,7 @@ impl CacheInfo {
3137
}
3238
}
3339

40+
/// Compute the cache info for a given directory.
3441
pub fn from_directory(directory: &Path) -> io::Result<Self> {
3542
let mut commit = None;
3643

@@ -103,6 +110,8 @@ impl CacheInfo {
103110
Ok(Self { timestamp, commit })
104111
}
105112

113+
/// Compute the cache info for a given file, assumed to be a binary or source distribution
114+
/// represented as (e.g.) a `.whl` or `.tar.gz` archive.
106115
pub fn from_file(path: impl AsRef<Path>) -> Result<Self, io::Error> {
107116
let metadata = fs_err::metadata(path.as_ref())?;
108117
let timestamp = Timestamp::from_metadata(&metadata);
@@ -126,7 +135,10 @@ struct TimestampCommit {
126135
#[derive(Debug, serde::Deserialize)]
127136
#[serde(untagged)]
128137
enum CacheInfoWire {
138+
/// For backwards-compatibility, enable deserializing [`CacheInfo`] structs that are solely
139+
/// represented by a timestamp.
129140
Timestamp(Timestamp),
141+
/// A [`CacheInfo`] struct that includes both a timestamp and a commit.
130142
TimestampCommit(TimestampCommit),
131143
}
132144

crates/uv-cache-info/src/commit_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::path::{Path, PathBuf};
22

3-
/// The current commit for a repository.
3+
/// The current commit for a repository (i.e., a 40-character hexadecimal string).
44
#[derive(Default, Debug, Clone, Hash, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
55
pub(crate) struct Commit(String);
66

crates/uv-dispatch/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ impl<'a> BuildContext for BuildDispatch<'a> {
214214
&BuildOptions::default(),
215215
self.hasher,
216216
self.index_locations,
217-
self.config_settings,
218217
self.cache(),
219218
venv,
220219
&markers,

crates/uv-distribution/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ license = { workspace = true }
1313
workspace = true
1414

1515
[dependencies]
16-
cache-key = { workspace = true }
1716
distribution-filename = { workspace = true }
1817
distribution-types = { workspace = true }
1918
install-wheel-rs = { workspace = true }

crates/uv-distribution/src/index/built_wheel_index.rs

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use distribution_types::{
77
use platform_tags::Tags;
88
use uv_cache::{Cache, CacheBucket, CacheShard, WheelCache};
99
use uv_cache_info::CacheInfo;
10-
use uv_configuration::ConfigSettings;
1110
use uv_fs::symlinks;
1211
use uv_types::HashStrategy;
1312

@@ -17,22 +16,15 @@ pub struct BuiltWheelIndex<'a> {
1716
cache: &'a Cache,
1817
tags: &'a Tags,
1918
hasher: &'a HashStrategy,
20-
build_configuration: &'a ConfigSettings,
2119
}
2220

2321
impl<'a> BuiltWheelIndex<'a> {
2422
/// Initialize an index of built distributions.
25-
pub fn new(
26-
cache: &'a Cache,
27-
tags: &'a Tags,
28-
hasher: &'a HashStrategy,
29-
build_configuration: &'a ConfigSettings,
30-
) -> Self {
23+
pub fn new(cache: &'a Cache, tags: &'a Tags, hasher: &'a HashStrategy) -> Self {
3124
Self {
3225
cache,
3326
tags,
3427
hasher,
35-
build_configuration,
3628
}
3729
}
3830

@@ -61,13 +53,6 @@ impl<'a> BuiltWheelIndex<'a> {
6153

6254
let cache_shard = cache_shard.shard(revision.id());
6355

64-
// If there are build settings, we need to scope to a cache shard.
65-
let cache_shard = if self.build_configuration.is_empty() {
66-
cache_shard
67-
} else {
68-
cache_shard.shard(cache_key::cache_digest(self.build_configuration))
69-
};
70-
7156
Ok(self.find(&cache_shard))
7257
}
7358
/// Return the most compatible [`CachedWheel`] for a given source distribution at a local path.
@@ -98,13 +83,6 @@ impl<'a> BuiltWheelIndex<'a> {
9883

9984
let cache_shard = cache_shard.shard(revision.id());
10085

101-
// If there are build settings, we need to scope to a cache shard.
102-
let cache_shard = if self.build_configuration.is_empty() {
103-
cache_shard
104-
} else {
105-
cache_shard.shard(cache_key::cache_digest(self.build_configuration))
106-
};
107-
10886
Ok(self
10987
.find(&cache_shard)
11088
.map(|wheel| wheel.with_cache_info(cache_info)))
@@ -147,13 +125,6 @@ impl<'a> BuiltWheelIndex<'a> {
147125

148126
let cache_shard = cache_shard.shard(revision.id());
149127

150-
// If there are build settings, we need to scope to a cache shard.
151-
let cache_shard = if self.build_configuration.is_empty() {
152-
cache_shard
153-
} else {
154-
cache_shard.shard(cache_key::cache_digest(self.build_configuration))
155-
};
156-
157128
Ok(self
158129
.find(&cache_shard)
159130
.map(|wheel| wheel.with_cache_info(cache_info)))
@@ -173,13 +144,6 @@ impl<'a> BuiltWheelIndex<'a> {
173144
WheelCache::Git(&source_dist.url, &git_sha.to_short_string()).root(),
174145
);
175146

176-
// If there are build settings, we need to scope to a cache shard.
177-
let cache_shard = if self.build_configuration.is_empty() {
178-
cache_shard
179-
} else {
180-
cache_shard.shard(cache_key::cache_digest(self.build_configuration))
181-
};
182-
183147
self.find(&cache_shard)
184148
}
185149

crates/uv-distribution/src/source/mod.rs

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -426,14 +426,6 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
426426
// freshness, since entries have to be fresher than the revision itself.
427427
let cache_shard = cache_shard.shard(revision.id());
428428

429-
// If there are build settings, we need to scope to a cache shard.
430-
let config_settings = self.build_context.config_settings();
431-
let cache_shard = if config_settings.is_empty() {
432-
cache_shard
433-
} else {
434-
cache_shard.shard(cache_key::cache_digest(config_settings))
435-
};
436-
437429
// If the cache contains a compatible wheel, return it.
438430
if let Some(built_wheel) = BuiltWheelMetadata::find_in_cache(tags, &cache_shard) {
439431
return Ok(built_wheel.with_hashes(revision.into_hashes()));
@@ -527,14 +519,6 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
527519
});
528520
}
529521

530-
// If there are build settings, we need to scope to a cache shard.
531-
let config_settings = self.build_context.config_settings();
532-
let cache_shard = if config_settings.is_empty() {
533-
cache_shard
534-
} else {
535-
cache_shard.shard(cache_key::cache_digest(config_settings))
536-
};
537-
538522
// Otherwise, we either need to build the metadata.
539523
// If the backend supports `prepare_metadata_for_build_wheel`, use it.
540524
if let Some(metadata) = self
@@ -687,14 +671,6 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
687671
// freshness, since entries have to be fresher than the revision itself.
688672
let cache_shard = cache_shard.shard(revision.id());
689673

690-
// If there are build settings, we need to scope to a cache shard.
691-
let config_settings = self.build_context.config_settings();
692-
let cache_shard = if config_settings.is_empty() {
693-
cache_shard
694-
} else {
695-
cache_shard.shard(cache_key::cache_digest(config_settings))
696-
};
697-
698674
// If the cache contains a compatible wheel, return it.
699675
if let Some(built_wheel) = BuiltWheelMetadata::find_in_cache(tags, &cache_shard) {
700676
return Ok(built_wheel);
@@ -805,14 +781,6 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
805781
});
806782
}
807783

808-
// If there are build settings, we need to scope to a cache shard.
809-
let config_settings = self.build_context.config_settings();
810-
let cache_shard = if config_settings.is_empty() {
811-
cache_shard
812-
} else {
813-
cache_shard.shard(cache_key::cache_digest(config_settings))
814-
};
815-
816784
// Otherwise, we need to build a wheel.
817785
let task = self
818786
.reporter
@@ -929,14 +897,6 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
929897
// freshness, since entries have to be fresher than the revision itself.
930898
let cache_shard = cache_shard.shard(revision.id());
931899

932-
// If there are build settings, we need to scope to a cache shard.
933-
let config_settings = self.build_context.config_settings();
934-
let cache_shard = if config_settings.is_empty() {
935-
cache_shard
936-
} else {
937-
cache_shard.shard(cache_key::cache_digest(config_settings))
938-
};
939-
940900
// If the cache contains a compatible wheel, return it.
941901
if let Some(built_wheel) = BuiltWheelMetadata::find_in_cache(tags, &cache_shard) {
942902
return Ok(built_wheel);
@@ -1060,14 +1020,6 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
10601020
));
10611021
}
10621022

1063-
// If there are build settings, we need to scope to a cache shard.
1064-
let config_settings = self.build_context.config_settings();
1065-
let cache_shard = if config_settings.is_empty() {
1066-
cache_shard
1067-
} else {
1068-
cache_shard.shard(cache_key::cache_digest(config_settings))
1069-
};
1070-
10711023
// Otherwise, we need to build a wheel.
10721024
let task = self
10731025
.reporter
@@ -1179,14 +1131,6 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
11791131

11801132
let _lock = lock_shard(&cache_shard).await?;
11811133

1182-
// If there are build settings, we need to scope to a cache shard.
1183-
let config_settings = self.build_context.config_settings();
1184-
let cache_shard = if config_settings.is_empty() {
1185-
cache_shard
1186-
} else {
1187-
cache_shard.shard(cache_key::cache_digest(config_settings))
1188-
};
1189-
11901134
// If the cache contains a compatible wheel, return it.
11911135
if let Some(built_wheel) = BuiltWheelMetadata::find_in_cache(tags, &cache_shard) {
11921136
return Ok(built_wheel);
@@ -1313,14 +1257,6 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
13131257
));
13141258
}
13151259

1316-
// If there are build settings, we need to scope to a cache shard.
1317-
let config_settings = self.build_context.config_settings();
1318-
let cache_shard = if config_settings.is_empty() {
1319-
cache_shard
1320-
} else {
1321-
cache_shard.shard(cache_key::cache_digest(config_settings))
1322-
};
1323-
13241260
// Otherwise, we need to build a wheel.
13251261
let task = self
13261262
.reporter

crates/uv-installer/src/plan.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use platform_tags::Tags;
1515
use pypi_types::{Requirement, RequirementSource, ResolverMarkerEnvironment};
1616
use uv_cache::{Cache, CacheBucket, WheelCache};
1717
use uv_cache_info::{CacheInfo, Timestamp};
18-
use uv_configuration::{BuildOptions, ConfigSettings, Reinstall};
18+
use uv_configuration::{BuildOptions, Reinstall};
1919
use uv_distribution::{
2020
BuiltWheelIndex, HttpArchivePointer, LocalArchivePointer, RegistryWheelIndex,
2121
};
@@ -57,15 +57,14 @@ impl<'a> Planner<'a> {
5757
build_options: &BuildOptions,
5858
hasher: &HashStrategy,
5959
index_locations: &IndexLocations,
60-
config_settings: &ConfigSettings,
6160
cache: &Cache,
6261
venv: &PythonEnvironment,
6362
markers: &ResolverMarkerEnvironment,
6463
tags: &Tags,
6564
) -> Result<Plan> {
6665
// Index all the already-downloaded wheels in the cache.
6766
let mut registry_index = RegistryWheelIndex::new(cache, tags, index_locations, hasher);
68-
let built_index = BuiltWheelIndex::new(cache, tags, hasher, config_settings);
67+
let built_index = BuiltWheelIndex::new(cache, tags, hasher);
6968

7069
let mut cached = vec![];
7170
let mut remote = vec![];

0 commit comments

Comments
 (0)