mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-22 16:22:09 +00:00
Avoid requires-python warning in virtual-only workspace (#5895)
## Summary There's no way for the user to address this, so we shouldn't show it.
This commit is contained in:
parent
4b2b2d2870
commit
9081509715
4 changed files with 13 additions and 4 deletions
|
@ -239,6 +239,7 @@ impl Workspace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns `true` if the workspace has a virtual root.
|
||||||
pub fn is_virtual(&self) -> bool {
|
pub fn is_virtual(&self) -> bool {
|
||||||
!self
|
!self
|
||||||
.packages
|
.packages
|
||||||
|
@ -246,6 +247,11 @@ impl Workspace {
|
||||||
.any(|member| *member.root() == self.install_path)
|
.any(|member| *member.root() == self.install_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns `true` if the workspace consists solely of a virtual root.
|
||||||
|
pub fn only_virtual(&self) -> bool {
|
||||||
|
self.packages.is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the set of requirements that include all packages in the workspace.
|
/// Returns the set of requirements that include all packages in the workspace.
|
||||||
pub fn members_requirements(&self) -> impl Iterator<Item = Requirement> + '_ {
|
pub fn members_requirements(&self) -> impl Iterator<Item = Requirement> + '_ {
|
||||||
self.packages.values().filter_map(|member| {
|
self.packages.values().filter_map(|member| {
|
||||||
|
|
|
@ -265,7 +265,13 @@ async fn do_lock(
|
||||||
} else {
|
} else {
|
||||||
let default =
|
let default =
|
||||||
RequiresPython::greater_than_equal_version(&interpreter.python_minor_version());
|
RequiresPython::greater_than_equal_version(&interpreter.python_minor_version());
|
||||||
warn_user!("No `requires-python` value found in the workspace. Defaulting to `{default}`.");
|
if workspace.only_virtual() {
|
||||||
|
debug!("No `requires-python` in virtual-only workspace. Defaulting to `{default}`.");
|
||||||
|
} else {
|
||||||
|
warn_user!(
|
||||||
|
"No `requires-python` value found in the workspace. Defaulting to `{default}`."
|
||||||
|
);
|
||||||
|
}
|
||||||
default
|
default
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2771,7 +2771,6 @@ fn add_virtual() -> Result<()> {
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
warning: `uv add` is experimental and may change without warning
|
warning: `uv add` is experimental and may change without warning
|
||||||
warning: No `requires-python` value found in the workspace. Defaulting to `>=3.12`.
|
|
||||||
Resolved 1 package in [TIME]
|
Resolved 1 package in [TIME]
|
||||||
Prepared 1 package in [TIME]
|
Prepared 1 package in [TIME]
|
||||||
Installed 1 package in [TIME]
|
Installed 1 package in [TIME]
|
||||||
|
|
|
@ -183,7 +183,6 @@ fn empty() -> Result<()> {
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
warning: `uv sync` is experimental and may change without warning
|
warning: `uv sync` is experimental and may change without warning
|
||||||
warning: No `requires-python` value found in the workspace. Defaulting to `>=3.12`.
|
|
||||||
Resolved 0 packages in [TIME]
|
Resolved 0 packages in [TIME]
|
||||||
Audited 0 packages in [TIME]
|
Audited 0 packages in [TIME]
|
||||||
"###);
|
"###);
|
||||||
|
@ -198,7 +197,6 @@ fn empty() -> Result<()> {
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
warning: `uv sync` is experimental and may change without warning
|
warning: `uv sync` is experimental and may change without warning
|
||||||
warning: No `requires-python` value found in the workspace. Defaulting to `>=3.12`.
|
|
||||||
Resolved 0 packages in [TIME]
|
Resolved 0 packages in [TIME]
|
||||||
Audited 0 packages in [TIME]
|
Audited 0 packages in [TIME]
|
||||||
"###);
|
"###);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue