diff --git a/crates/uv/src/commands/project/environment.rs b/crates/uv/src/commands/project/environment.rs index 5c67b782d..a029ca668 100644 --- a/crates/uv/src/commands/project/environment.rs +++ b/crates/uv/src/commands/project/environment.rs @@ -11,7 +11,7 @@ use uv_cache::{Cache, CacheBucket}; use uv_cache_key::{cache_digest, hash_digest}; use uv_client::Connectivity; use uv_configuration::{Concurrency, TrustedHost}; -use uv_distribution_types::Resolution; +use uv_distribution_types::{Name, Resolution}; use uv_python::{Interpreter, PythonEnvironment}; /// A [`PythonEnvironment`] stored in the cache. @@ -79,7 +79,8 @@ impl CachedEnvironment { // TODO(charlie): If the resolution contains any mutable metadata (like a path or URL // dependency), skip this step. let resolution_hash = { - let distributions = resolution.distributions().collect::>(); + let mut distributions = resolution.distributions().collect::>(); + distributions.sort_unstable_by_key(|dist| dist.name()); hash_digest(&distributions) };