Add preview warning

This commit is contained in:
Zanie Blue 2025-07-24 18:06:35 -05:00
parent fb0ca39c69
commit 49a75fa797
2 changed files with 21 additions and 1 deletions

View File

@ -24,7 +24,7 @@ use uv_distribution_types::{
use uv_git::ResolvedRepositoryReference;
use uv_normalize::{GroupName, PackageName};
use uv_pep440::Version;
use uv_pypi_types::{Conflicts, SupportedEnvironments};
use uv_pypi_types::{ConflictKind, Conflicts, SupportedEnvironments};
use uv_python::{Interpreter, PythonDownloads, PythonEnvironment, PythonPreference, PythonRequest};
use uv_requirements::ExtrasResolver;
use uv_requirements::upgrade::{LockedRequirements, read_lock_requirements};
@ -476,6 +476,21 @@ async fn do_lock(
}
}
// Check if any conflicts contain project-level conflicts
if preview.is_disabled() {
for set in conflicts.iter() {
if set
.iter()
.any(|item| matches!(item.kind(), ConflictKind::Project))
{
warn_user_once!(
"Declaring conflicts for packages (`package = ...`) is experimental and may change without warning. Pass `--preview` to disable this warning."
);
break;
}
}
}
// Collect the list of supported environments.
let environments = {
let environments = target.environments();

View File

@ -2947,6 +2947,7 @@ fn lock_conflicting_workspace_members() -> Result<()> {
----- stdout -----
----- stderr -----
warning: Declaring conflicts for packages (`package = ...`) is experimental and may change without warning. Pass `--preview` to disable this warning.
Resolved 4 packages in [TIME]
");
@ -3123,6 +3124,7 @@ fn lock_conflicting_workspace_members_depends_direct() -> Result<()> {
----- stdout -----
----- stderr -----
warning: Declaring conflicts for packages (`package = ...`) is experimental and may change without warning. Pass `--preview` to disable this warning.
× No solution found when resolving dependencies:
Because subexample depends on sortedcontainers==2.4.0 and example depends on sortedcontainers==2.3.0, we can conclude that example and subexample are incompatible.
And because example depends on subexample and your workspace requires example, we can conclude that your workspace's requirements are unsatisfiable.
@ -3202,6 +3204,7 @@ fn lock_conflicting_workspace_members_depends_direct_extra() -> Result<()> {
----- stdout -----
----- stderr -----
warning: Declaring conflicts for packages (`package = ...`) is experimental and may change without warning. Pass `--preview` to disable this warning.
Resolved 4 packages in [TIME]
");
@ -3418,6 +3421,7 @@ fn lock_conflicting_workspace_members_depends_transitive() -> Result<()> {
----- stdout -----
----- stderr -----
warning: Declaring conflicts for packages (`package = ...`) is experimental and may change without warning. Pass `--preview` to disable this warning.
× No solution found when resolving dependencies:
Because subexample depends on sortedcontainers==2.4.0 and indirection depends on subexample, we can conclude that indirection depends on sortedcontainers==2.4.0.
And because example depends on sortedcontainers==2.3.0, we can conclude that example and indirection are incompatible.
@ -3518,6 +3522,7 @@ fn lock_conflicting_workspace_members_depends_transitive_extra() -> Result<()> {
----- stdout -----
----- stderr -----
warning: Declaring conflicts for packages (`package = ...`) is experimental and may change without warning. Pass `--preview` to disable this warning.
Resolved 5 packages in [TIME]
");