Skip to content

Commit 71e4d07

Browse files
committed
Remove warnings for missing lower bounds
Does not include the "lowest" resolution mode, in which lower bounds are critical
1 parent 1be8ba7 commit 71e4d07

File tree

30 files changed

+49
-185
lines changed

30 files changed

+49
-185
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/uv-bench/benches/uv.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ mod resolver {
8686
use uv_cache::Cache;
8787
use uv_client::RegistryClient;
8888
use uv_configuration::{
89-
BuildOptions, Concurrency, ConfigSettings, Constraints, IndexStrategy, LowerBound,
90-
PreviewMode, SourceStrategy,
89+
BuildOptions, Concurrency, ConfigSettings, Constraints, IndexStrategy, PreviewMode,
90+
SourceStrategy,
9191
};
9292
use uv_dispatch::{BuildDispatch, SharedState};
9393
use uv_distribution::DistributionDatabase;
@@ -187,7 +187,6 @@ mod resolver {
187187
&build_options,
188188
&hashes,
189189
exclude_newer,
190-
LowerBound::default(),
191190
sources,
192191
concurrency,
193192
PreviewMode::Enabled,

crates/uv-build-frontend/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use tokio::process::Command;
2626
use tokio::sync::{Mutex, Semaphore};
2727
use tracing::{debug, info_span, instrument, Instrument};
2828

29-
use uv_configuration::{BuildKind, BuildOutput, ConfigSettings, LowerBound, SourceStrategy};
29+
use uv_configuration::{BuildKind, BuildOutput, ConfigSettings, SourceStrategy};
3030
use uv_distribution::BuildRequires;
3131
use uv_distribution_types::{IndexLocations, Resolution};
3232
use uv_fs::{PythonExt, Simplified};
@@ -480,7 +480,6 @@ impl SourceBuild {
480480
install_path,
481481
locations,
482482
source_strategy,
483-
LowerBound::Allow,
484483
)
485484
.await
486485
.map_err(Error::Lowering)?;
@@ -910,7 +909,6 @@ async fn create_pep517_build_environment(
910909
install_path,
911910
locations,
912911
source_strategy,
913-
LowerBound::Allow,
914912
)
915913
.await
916914
.map_err(Error::Lowering)?;

crates/uv-configuration/src/bounds.rs

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

crates/uv-configuration/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
pub use authentication::*;
2-
pub use bounds::*;
32
pub use build_options::*;
43
pub use concurrency::*;
54
pub use config_settings::*;
@@ -24,7 +23,6 @@ pub use trusted_publishing::*;
2423
pub use vcs::*;
2524

2625
mod authentication;
27-
mod bounds;
2826
mod build_options;
2927
mod concurrency;
3028
mod config_settings;

crates/uv-dispatch/src/lib.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use uv_build_frontend::{SourceBuild, SourceBuildContext};
1616
use uv_cache::Cache;
1717
use uv_client::RegistryClient;
1818
use uv_configuration::{
19-
BuildKind, BuildOptions, ConfigSettings, Constraints, IndexStrategy, LowerBound, PreviewMode,
20-
Reinstall, SourceStrategy,
19+
BuildKind, BuildOptions, ConfigSettings, Constraints, IndexStrategy, PreviewMode, Reinstall,
20+
SourceStrategy,
2121
};
2222
use uv_configuration::{BuildOutput, Concurrency};
2323
use uv_distribution::DistributionDatabase;
@@ -93,7 +93,7 @@ pub struct BuildDispatch<'a> {
9393
exclude_newer: Option<ExcludeNewer>,
9494
source_build_context: SourceBuildContext,
9595
build_extra_env_vars: FxHashMap<OsString, OsString>,
96-
bounds: LowerBound,
96+
9797
sources: SourceStrategy,
9898
concurrency: Concurrency,
9999
preview: PreviewMode,
@@ -116,7 +116,6 @@ impl<'a> BuildDispatch<'a> {
116116
build_options: &'a BuildOptions,
117117
hasher: &'a HashStrategy,
118118
exclude_newer: Option<ExcludeNewer>,
119-
bounds: LowerBound,
120119
sources: SourceStrategy,
121120
concurrency: Concurrency,
122121
preview: PreviewMode,
@@ -139,7 +138,7 @@ impl<'a> BuildDispatch<'a> {
139138
exclude_newer,
140139
source_build_context: SourceBuildContext::default(),
141140
build_extra_env_vars: FxHashMap::default(),
142-
bounds,
141+
143142
sources,
144143
concurrency,
145144
preview,
@@ -194,10 +193,6 @@ impl BuildContext for BuildDispatch<'_> {
194193
self.config_settings
195194
}
196195

197-
fn bounds(&self) -> LowerBound {
198-
self.bounds
199-
}
200-
201196
fn sources(&self) -> SourceStrategy {
202197
self.sources
203198
}

crates/uv-distribution/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ uv-pep508 = { workspace = true }
3333
uv-platform-tags = { workspace = true }
3434
uv-pypi-types = { workspace = true }
3535
uv-types = { workspace = true }
36-
uv-warnings = { workspace = true }
3736
uv-workspace = { workspace = true }
3837

3938
anyhow = { workspace = true }

crates/uv-distribution/src/metadata/build_requires.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::BTreeMap;
22
use std::path::Path;
33

4-
use uv_configuration::{LowerBound, SourceStrategy};
4+
use uv_configuration::SourceStrategy;
55
use uv_distribution_types::IndexLocations;
66
use uv_normalize::PackageName;
77
use uv_workspace::pyproject::ToolUvSources;
@@ -37,7 +37,6 @@ impl BuildRequires {
3737
install_path: &Path,
3838
locations: &IndexLocations,
3939
sources: SourceStrategy,
40-
lower_bound: LowerBound,
4140
) -> Result<Self, MetadataError> {
4241
let discovery = match sources {
4342
SourceStrategy::Enabled => DiscoveryOptions::default(),
@@ -54,13 +53,7 @@ impl BuildRequires {
5453
return Ok(Self::from_metadata23(metadata));
5554
};
5655

57-
Self::from_project_workspace(
58-
metadata,
59-
&project_workspace,
60-
locations,
61-
sources,
62-
lower_bound,
63-
)
56+
Self::from_project_workspace(metadata, &project_workspace, locations, sources)
6457
}
6558

6659
/// Lower the `build-system.requires` field from a `pyproject.toml` file.
@@ -69,7 +62,6 @@ impl BuildRequires {
6962
project_workspace: &ProjectWorkspace,
7063
locations: &IndexLocations,
7164
source_strategy: SourceStrategy,
72-
lower_bound: LowerBound,
7365
) -> Result<Self, MetadataError> {
7466
// Collect any `tool.uv.index` entries.
7567
let empty = vec![];
@@ -118,7 +110,6 @@ impl BuildRequires {
118110
group,
119111
locations,
120112
project_workspace.workspace(),
121-
lower_bound,
122113
None,
123114
)
124115
.map(move |requirement| match requirement {
@@ -148,7 +139,6 @@ impl BuildRequires {
148139
workspace: &Workspace,
149140
locations: &IndexLocations,
150141
source_strategy: SourceStrategy,
151-
lower_bound: LowerBound,
152142
) -> Result<Self, MetadataError> {
153143
// Collect any `tool.uv.index` entries.
154144
let empty = vec![];
@@ -195,7 +185,6 @@ impl BuildRequires {
195185
group,
196186
locations,
197187
workspace,
198-
lower_bound,
199188
None,
200189
)
201190
.map(move |requirement| match requirement {

crates/uv-distribution/src/metadata/lowering.rs

Lines changed: 13 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use either::Either;
66
use thiserror::Error;
77
use url::Url;
88

9-
use uv_configuration::LowerBound;
109
use uv_distribution_filename::DistExtension;
1110
use uv_distribution_types::{Index, IndexLocations, IndexName, Origin};
1211
use uv_git::GitReference;
@@ -16,7 +15,6 @@ use uv_pep508::{looks_like_git_repository, MarkerTree, VerbatimUrl, VersionOrUrl
1615
use uv_pypi_types::{
1716
ConflictItem, ParsedUrlError, Requirement, RequirementSource, VerbatimParsedUrl,
1817
};
19-
use uv_warnings::warn_user_once;
2018
use uv_workspace::pyproject::{PyProjectToml, Source, Sources};
2119
use uv_workspace::Workspace;
2220

@@ -45,7 +43,7 @@ impl LoweredRequirement {
4543
group: Option<&GroupName>,
4644
locations: &'data IndexLocations,
4745
workspace: &'data Workspace,
48-
lower_bound: LowerBound,
46+
4947
git_member: Option<&'data GitWorkspaceMember<'data>>,
5048
) -> impl Iterator<Item = Result<Self, LoweringError>> + 'data {
5149
// Identify the source from the `tool.uv.sources` table.
@@ -136,19 +134,6 @@ impl LoweredRequirement {
136134
}
137135

138136
let Some(sources) = sources else {
139-
let has_sources = !project_sources.is_empty() || !workspace.sources().is_empty();
140-
if matches!(lower_bound, LowerBound::Warn) {
141-
// Support recursive editable inclusions.
142-
if has_sources
143-
&& requirement.version_or_url.is_none()
144-
&& project_name.is_none_or(|project_name| *project_name != requirement.name)
145-
{
146-
warn_user_once!(
147-
"Missing version constraint (e.g., a lower bound) for `{}`",
148-
requirement.name
149-
);
150-
}
151-
}
152137
return Either::Left(std::iter::once(Ok(Self(Requirement::from(requirement)))));
153138
};
154139

@@ -252,12 +237,7 @@ impl LoweredRequirement {
252237
})
253238
}
254239
});
255-
let source = registry_source(
256-
&requirement,
257-
index.into_url(),
258-
conflict,
259-
lower_bound,
260-
);
240+
let source = registry_source(&requirement, index.into_url(), conflict);
261241
(source, marker)
262242
}
263243
Source::Workspace {
@@ -367,7 +347,6 @@ impl LoweredRequirement {
367347
sources: &'data BTreeMap<PackageName, Sources>,
368348
indexes: &'data [Index],
369349
locations: &'data IndexLocations,
370-
lower_bound: LowerBound,
371350
) -> impl Iterator<Item = Result<Self, LoweringError>> + 'data {
372351
let source = sources.get(&requirement.name).cloned();
373352

@@ -473,12 +452,7 @@ impl LoweredRequirement {
473452
));
474453
};
475454
let conflict = None;
476-
let source = registry_source(
477-
&requirement,
478-
index.into_url(),
479-
conflict,
480-
lower_bound,
481-
);
455+
let source = registry_source(&requirement, index.into_url(), conflict);
482456
(source, marker)
483457
}
484458
Source::Workspace { .. } => {
@@ -652,40 +626,23 @@ fn registry_source(
652626
requirement: &uv_pep508::Requirement<VerbatimParsedUrl>,
653627
index: Url,
654628
conflict: Option<ConflictItem>,
655-
bounds: LowerBound,
656629
) -> RequirementSource {
657630
match &requirement.version_or_url {
658-
None => {
659-
if matches!(bounds, LowerBound::Warn) {
660-
warn_user_once!(
661-
"Missing version constraint (e.g., a lower bound) for `{}`",
662-
requirement.name
663-
);
664-
}
665-
RequirementSource::Registry {
666-
specifier: VersionSpecifiers::empty(),
667-
index: Some(index),
668-
conflict,
669-
}
670-
}
631+
None => RequirementSource::Registry {
632+
specifier: VersionSpecifiers::empty(),
633+
index: Some(index),
634+
conflict,
635+
},
671636
Some(VersionOrUrl::VersionSpecifier(version)) => RequirementSource::Registry {
672637
specifier: version.clone(),
673638
index: Some(index),
674639
conflict,
675640
},
676-
Some(VersionOrUrl::Url(_)) => {
677-
if matches!(bounds, LowerBound::Warn) {
678-
warn_user_once!(
679-
"Missing version constraint (e.g., a lower bound) for `{}` due to use of a URL specifier",
680-
requirement.name
681-
);
682-
}
683-
RequirementSource::Registry {
684-
specifier: VersionSpecifiers::empty(),
685-
index: Some(index),
686-
conflict,
687-
}
688-
}
641+
Some(VersionOrUrl::Url(_)) => RequirementSource::Registry {
642+
specifier: VersionSpecifiers::empty(),
643+
index: Some(index),
644+
conflict,
645+
},
689646
}
690647
}
691648

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::path::Path;
33

44
use thiserror::Error;
55

6-
use uv_configuration::{LowerBound, SourceStrategy};
6+
use uv_configuration::SourceStrategy;
77
use uv_distribution_types::{GitSourceUrl, IndexLocations};
88
use uv_normalize::{ExtraName, GroupName, PackageName};
99
use uv_pep440::{Version, VersionSpecifiers};
@@ -80,7 +80,6 @@ impl Metadata {
8080
git_source: Option<&GitWorkspaceMember<'_>>,
8181
locations: &IndexLocations,
8282
sources: SourceStrategy,
83-
bounds: LowerBound,
8483
) -> Result<Self, MetadataError> {
8584
// Lower the requirements.
8685
let requires_dist = uv_pypi_types::RequiresDist {
@@ -101,7 +100,6 @@ impl Metadata {
101100
git_source,
102101
locations,
103102
sources,
104-
bounds,
105103
)
106104
.await?;
107105

0 commit comments

Comments
 (0)