diff --git a/crates/uv/src/commands/cache_dir.rs b/crates/uv/src/commands/cache_dir.rs index 2ff797733..43cdd6333 100644 --- a/crates/uv/src/commands/cache_dir.rs +++ b/crates/uv/src/commands/cache_dir.rs @@ -1,4 +1,5 @@ use owo_colors::OwoColorize; + use uv_cache::Cache; use uv_fs::Simplified; diff --git a/crates/uv/src/commands/project/ephemeral.rs b/crates/uv/src/commands/project/environment.rs similarity index 93% rename from crates/uv/src/commands/project/ephemeral.rs rename to crates/uv/src/commands/project/environment.rs index 3ececa04f..d83f6d3e5 100644 --- a/crates/uv/src/commands/project/ephemeral.rs +++ b/crates/uv/src/commands/project/environment.rs @@ -17,16 +17,16 @@ use crate::settings::ResolverInstallerSettings; /// An ephemeral [`PythonEnvironment`] stored in the cache. #[derive(Debug)] -pub(crate) struct EphemeralEnvironment(PythonEnvironment); +pub(crate) struct CachedEnvironment(PythonEnvironment); -impl From for PythonEnvironment { - fn from(ephemeral: EphemeralEnvironment) -> Self { +impl From for PythonEnvironment { + fn from(ephemeral: CachedEnvironment) -> Self { ephemeral.0 } } -impl EphemeralEnvironment { - /// Get or create an [`EphemeralEnvironment`] based on a given set of requirements and a base +impl CachedEnvironment { + /// Get or create an [`CachedEnvironment`] based on a given set of requirements and a base /// interpreter. pub(crate) async fn get_or_create( requirements: Vec, diff --git a/crates/uv/src/commands/project/mod.rs b/crates/uv/src/commands/project/mod.rs index 5d25b3d9a..bd28c1597 100644 --- a/crates/uv/src/commands/project/mod.rs +++ b/crates/uv/src/commands/project/mod.rs @@ -31,7 +31,7 @@ use crate::printer::Printer; use crate::settings::{InstallerSettingsRef, ResolverInstallerSettings, ResolverSettingsRef}; pub(crate) mod add; -pub(crate) mod ephemeral; +pub(crate) mod environment; pub(crate) mod lock; pub(crate) mod remove; pub(crate) mod run; diff --git a/crates/uv/src/commands/python/dir.rs b/crates/uv/src/commands/python/dir.rs index 5fe3f3fc8..73c9efa61 100644 --- a/crates/uv/src/commands/python/dir.rs +++ b/crates/uv/src/commands/python/dir.rs @@ -1,5 +1,6 @@ use anyhow::Context; use owo_colors::OwoColorize; + use uv_configuration::PreviewMode; use uv_fs::Simplified; use uv_python::managed::ManagedPythonInstallations; diff --git a/crates/uv/src/commands/python/find.rs b/crates/uv/src/commands/python/find.rs index 5a35d7150..d8992e306 100644 --- a/crates/uv/src/commands/python/find.rs +++ b/crates/uv/src/commands/python/find.rs @@ -1,6 +1,7 @@ -use anyhow::Result; use std::fmt::Write; +use anyhow::Result; + use uv_cache::Cache; use uv_configuration::PreviewMode; use uv_fs::Simplified; diff --git a/crates/uv/src/commands/python/install.rs b/crates/uv/src/commands/python/install.rs index 9d463f510..e705ef5f2 100644 --- a/crates/uv/src/commands/python/install.rs +++ b/crates/uv/src/commands/python/install.rs @@ -1,6 +1,8 @@ +use std::fmt::Write; + use anyhow::Result; use futures::StreamExt; -use std::fmt::Write; + use uv_cache::Cache; use uv_client::Connectivity; use uv_configuration::PreviewMode; diff --git a/crates/uv/src/commands/python/uninstall.rs b/crates/uv/src/commands/python/uninstall.rs index 6c36a444b..90b499699 100644 --- a/crates/uv/src/commands/python/uninstall.rs +++ b/crates/uv/src/commands/python/uninstall.rs @@ -1,8 +1,10 @@ +use std::collections::BTreeSet; +use std::fmt::Write; + use anyhow::Result; use futures::StreamExt; use itertools::Itertools; -use std::collections::BTreeSet; -use std::fmt::Write; + use uv_configuration::PreviewMode; use uv_python::downloads::{self, PythonDownloadRequest}; use uv_python::managed::ManagedPythonInstallations; diff --git a/crates/uv/src/commands/self_update.rs b/crates/uv/src/commands/self_update.rs index 1d2af2c2a..be3b5050d 100644 --- a/crates/uv/src/commands/self_update.rs +++ b/crates/uv/src/commands/self_update.rs @@ -4,6 +4,7 @@ use anyhow::Result; use axoupdater::{AxoUpdater, AxoupdateError}; use owo_colors::OwoColorize; use tracing::debug; + use uv_client::WrappedReqwestError; use crate::commands::ExitStatus; diff --git a/crates/uv/src/commands/tool/dir.rs b/crates/uv/src/commands/tool/dir.rs index 72396f833..559379dd6 100644 --- a/crates/uv/src/commands/tool/dir.rs +++ b/crates/uv/src/commands/tool/dir.rs @@ -1,5 +1,6 @@ use anyhow::Context; use owo_colors::OwoColorize; + use uv_configuration::PreviewMode; use uv_fs::Simplified; use uv_tool::InstalledTools; diff --git a/crates/uv/src/commands/tool/run.rs b/crates/uv/src/commands/tool/run.rs index 62dfd6c35..e075db884 100644 --- a/crates/uv/src/commands/tool/run.rs +++ b/crates/uv/src/commands/tool/run.rs @@ -23,7 +23,7 @@ use uv_python::{ use uv_tool::InstalledTools; use uv_warnings::warn_user_once; -use crate::commands::project::ephemeral::EphemeralEnvironment; +use crate::commands::project::environment::CachedEnvironment; use crate::commands::tool::common::resolve_requirements; use crate::commands::{ExitStatus, SharedState}; use crate::printer::Printer; @@ -248,7 +248,7 @@ async fn get_or_create_environment( // TODO(zanieb): When implementing project-level tools, discover the project and check if it has the tool. // TODO(zanieb): Determine if we should layer on top of the project environment if it is present. - let environment = EphemeralEnvironment::get_or_create( + let environment = CachedEnvironment::get_or_create( requirements, interpreter, settings, diff --git a/crates/uv/src/commands/tool/uninstall.rs b/crates/uv/src/commands/tool/uninstall.rs index 27d4f8611..d8a5499a7 100644 --- a/crates/uv/src/commands/tool/uninstall.rs +++ b/crates/uv/src/commands/tool/uninstall.rs @@ -2,8 +2,8 @@ use std::fmt::Write; use anyhow::{bail, Result}; use itertools::Itertools; - use tracing::debug; + use uv_configuration::PreviewMode; use uv_fs::Simplified; use uv_normalize::PackageName; diff --git a/crates/uv/src/version.rs b/crates/uv/src/version.rs index 449a6ca6f..323fc0a48 100644 --- a/crates/uv/src/version.rs +++ b/crates/uv/src/version.rs @@ -1,7 +1,8 @@ //! Code for representing uv's release version number. +use std::fmt; + // See also use serde::Serialize; -use std::fmt; /// Information about the git repository where uv was built from. #[derive(Serialize)] diff --git a/crates/uv/tests/python_dir.rs b/crates/uv/tests/python_dir.rs index ac480948e..f78949fcd 100644 --- a/crates/uv/tests/python_dir.rs +++ b/crates/uv/tests/python_dir.rs @@ -1,4 +1,5 @@ use assert_fs::fixture::PathChild; + use common::{uv_snapshot, TestContext}; mod common; diff --git a/crates/uv/tests/tool_dir.rs b/crates/uv/tests/tool_dir.rs index eb72ca314..f819cda07 100644 --- a/crates/uv/tests/tool_dir.rs +++ b/crates/uv/tests/tool_dir.rs @@ -1,6 +1,7 @@ #![cfg(all(feature = "python", feature = "pypi"))] use assert_fs::fixture::PathChild; + use common::{uv_snapshot, TestContext}; mod common; diff --git a/crates/uv/tests/tool_install.rs b/crates/uv/tests/tool_install.rs index 7e0261dd2..93914e986 100644 --- a/crates/uv/tests/tool_install.rs +++ b/crates/uv/tests/tool_install.rs @@ -6,10 +6,11 @@ use assert_fs::{ assert::PathAssert, fixture::{FileTouch, PathChild}, }; -use common::{uv_snapshot, TestContext}; use insta::assert_snapshot; use predicates::prelude::predicate; +use common::{uv_snapshot, TestContext}; + mod common; /// Test installing a tool with `uv tool install` diff --git a/crates/uv/tests/tool_list.rs b/crates/uv/tests/tool_list.rs index b4f8cdf52..e87b50379 100644 --- a/crates/uv/tests/tool_list.rs +++ b/crates/uv/tests/tool_list.rs @@ -1,11 +1,12 @@ #![cfg(all(feature = "python", feature = "pypi"))] -use fs_err as fs; - use anyhow::Result; use assert_cmd::assert::OutputAssertExt; use assert_fs::fixture::PathChild; +use fs_err as fs; + use common::{uv_snapshot, TestContext}; + mod common; #[test] diff --git a/crates/uv/tests/tool_uninstall.rs b/crates/uv/tests/tool_uninstall.rs index 06402bbe6..b9a8bbb52 100644 --- a/crates/uv/tests/tool_uninstall.rs +++ b/crates/uv/tests/tool_uninstall.rs @@ -2,6 +2,7 @@ use assert_cmd::assert::OutputAssertExt; use assert_fs::fixture::PathChild; + use common::{uv_snapshot, TestContext}; mod common;