mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Rename EphemeralEnvironment
to CachedEnvironment
(#4804)
This commit is contained in:
parent
c6f72d333a
commit
cf004fd644
17 changed files with 32 additions and 17 deletions
|
@ -1,4 +1,5 @@
|
|||
use owo_colors::OwoColorize;
|
||||
|
||||
use uv_cache::Cache;
|
||||
use uv_fs::Simplified;
|
||||
|
||||
|
|
|
@ -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<EphemeralEnvironment> for PythonEnvironment {
|
||||
fn from(ephemeral: EphemeralEnvironment) -> Self {
|
||||
impl From<CachedEnvironment> 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<Requirement>,
|
|
@ -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;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use anyhow::Context;
|
||||
use owo_colors::OwoColorize;
|
||||
|
||||
use uv_configuration::PreviewMode;
|
||||
use uv_fs::Simplified;
|
||||
use uv_python::managed::ManagedPythonInstallations;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use anyhow::Context;
|
||||
use owo_colors::OwoColorize;
|
||||
|
||||
use uv_configuration::PreviewMode;
|
||||
use uv_fs::Simplified;
|
||||
use uv_tool::InstalledTools;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
//! Code for representing uv's release version number.
|
||||
use std::fmt;
|
||||
|
||||
// See also <https://github.com/astral-sh/ruff/blob/8118d29419055b779719cc96cdf3dacb29ac47c9/crates/ruff/src/version.rs>
|
||||
use serde::Serialize;
|
||||
use std::fmt;
|
||||
|
||||
/// Information about the git repository where uv was built from.
|
||||
#[derive(Serialize)]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use assert_fs::fixture::PathChild;
|
||||
|
||||
use common::{uv_snapshot, TestContext};
|
||||
|
||||
mod common;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#![cfg(all(feature = "python", feature = "pypi"))]
|
||||
|
||||
use assert_fs::fixture::PathChild;
|
||||
|
||||
use common::{uv_snapshot, TestContext};
|
||||
|
||||
mod common;
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::fixture::PathChild;
|
||||
|
||||
use common::{uv_snapshot, TestContext};
|
||||
|
||||
mod common;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue