mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-03 18:38:21 +00:00
Error when workspace contains conflicting Python requirements (#10841)
## Summary If members define disjoint Python requirements, we should error. Right now, it seems that it maps to unbounded and leads to weird behavior. Closes https://github.com/astral-sh/uv/issues/10835.
This commit is contained in:
parent
1372c4e6de
commit
434706389b
9 changed files with 113 additions and 19 deletions
|
@ -9,6 +9,7 @@ use tracing::{debug, trace, warn};
|
|||
use uv_distribution_types::Index;
|
||||
use uv_fs::{Simplified, CWD};
|
||||
use uv_normalize::{GroupName, PackageName, DEV_DEPENDENCIES};
|
||||
use uv_pep440::VersionSpecifiers;
|
||||
use uv_pep508::{MarkerTree, VerbatimUrl};
|
||||
use uv_pypi_types::{
|
||||
Conflicts, Requirement, RequirementSource, SupportedEnvironments, VerbatimParsedUrl,
|
||||
|
@ -383,6 +384,18 @@ impl Workspace {
|
|||
conflicting
|
||||
}
|
||||
|
||||
/// Returns an iterator over the `requires-python` values for each member of the workspace.
|
||||
pub fn requires_python(&self) -> impl Iterator<Item = (&PackageName, &VersionSpecifiers)> {
|
||||
self.packages().iter().filter_map(|(name, member)| {
|
||||
member
|
||||
.pyproject_toml()
|
||||
.project
|
||||
.as_ref()
|
||||
.and_then(|project| project.requires_python.as_ref())
|
||||
.map(|requires_python| (name, requires_python))
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns any requirements that are exclusive to the workspace root, i.e., not included in
|
||||
/// any of the workspace members.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue