From b4bc40627cbae4df840d560db9b9ab4fb65f9e6b Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 21 Feb 2024 13:33:06 -0500 Subject: [PATCH] Sort output when installing seed packages (#1822) This output is technically non-deterministic right now. --- crates/uv/src/commands/venv.rs | 6 +++++- crates/uv/tests/venv.rs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/uv/src/commands/venv.rs b/crates/uv/src/commands/venv.rs index 31b826f79..72cbfc800 100644 --- a/crates/uv/src/commands/venv.rs +++ b/crates/uv/src/commands/venv.rs @@ -6,6 +6,7 @@ use std::vec; use anstream::eprint; use anyhow::Result; use chrono::{DateTime, Utc}; +use itertools::Itertools; use miette::{Diagnostic, IntoDiagnostic}; use owo_colors::OwoColorize; use thiserror::Error; @@ -184,7 +185,10 @@ async fn venv_impl( .await .map_err(VenvError::Seed)?; - for distribution in resolution.distributions() { + for distribution in resolution + .distributions() + .sorted_unstable_by(|a, b| a.name().cmp(b.name()).then(a.version().cmp(&b.version()))) + { writeln!( printer, " {} {}{}", diff --git a/crates/uv/tests/venv.rs b/crates/uv/tests/venv.rs index 1567d44d6..f2d9585f9 100644 --- a/crates/uv/tests/venv.rs +++ b/crates/uv/tests/venv.rs @@ -232,8 +232,8 @@ fn seed_older_python_version() -> Result<()> { ----- stderr ----- Using Python [VERSION] interpreter at [PATH] Creating virtualenv at: /home/ferris/project/.venv - + setuptools==68.2.2 + pip==23.3.1 + + setuptools==68.2.2 + wheel==0.41.3 Activate with: source /home/ferris/project/.venv/bin/activate "###