Rename Virtualenv and PythonPlatform structs (#2034)

## Summary

`PythonPlatform` only exists to format paths to directories within
virtual environments based on a root and an OS, so it's now
`VirtualenvLayout`.

`Virtualenv` is now used for non-virtual environment Pythons, so it's
now `PythonEnvironment`.
This commit is contained in:
Charlie Marsh 2024-02-28 10:04:55 -05:00 committed by GitHub
parent 02703281f0
commit 1ee28f78cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 101 additions and 121 deletions

View file

@ -12,7 +12,7 @@ use uv_cache::{Cache, CacheArgs};
use uv_client::{FlatIndex, RegistryClientBuilder};
use uv_dispatch::BuildDispatch;
use uv_installer::NoBinary;
use uv_interpreter::Virtualenv;
use uv_interpreter::PythonEnvironment;
use uv_resolver::InMemoryIndex;
use uv_traits::{BuildContext, BuildKind, ConfigSettings, InFlight, NoBuild, SetupPyStrategy};
@ -54,7 +54,7 @@ pub(crate) async fn build(args: BuildArgs) -> Result<PathBuf> {
let cache = Cache::try_from(args.cache_args)?;
let platform = Platform::current()?;
let venv = Virtualenv::from_env(platform, &cache)?;
let venv = PythonEnvironment::from_virtualenv(platform, &cache)?;
let client = RegistryClientBuilder::new(cache.clone()).build();
let index_urls = IndexLocations::default();
let flat_index = FlatIndex::default();

View file

@ -21,7 +21,7 @@ use uv_client::{FlatIndex, RegistryClient, RegistryClientBuilder};
use uv_dispatch::BuildDispatch;
use uv_distribution::RegistryWheelIndex;
use uv_installer::{Downloader, NoBinary};
use uv_interpreter::Virtualenv;
use uv_interpreter::PythonEnvironment;
use uv_normalize::PackageName;
use uv_resolver::{DistFinder, InMemoryIndex};
use uv_traits::{BuildContext, ConfigSettings, InFlight, NoBuild, SetupPyStrategy};
@ -56,7 +56,7 @@ pub(crate) async fn install_many(args: InstallManyArgs) -> Result<()> {
let cache = Cache::try_from(args.cache_args)?;
let platform = Platform::current()?;
let venv = Virtualenv::from_env(platform, &cache)?;
let venv = PythonEnvironment::from_virtualenv(platform, &cache)?;
let client = RegistryClientBuilder::new(cache.clone()).build();
let index_locations = IndexLocations::default();
let flat_index = FlatIndex::default();
@ -112,7 +112,7 @@ async fn install_chunk(
build_dispatch: &BuildDispatch<'_>,
tags: &Tags,
client: &RegistryClient,
venv: &Virtualenv,
venv: &PythonEnvironment,
index_locations: &IndexLocations,
) -> Result<()> {
let resolution: Vec<_> = DistFinder::new(

View file

@ -16,7 +16,7 @@ use uv_cache::{Cache, CacheArgs};
use uv_client::{FlatIndex, FlatIndexClient, RegistryClientBuilder};
use uv_dispatch::BuildDispatch;
use uv_installer::NoBinary;
use uv_interpreter::Virtualenv;
use uv_interpreter::PythonEnvironment;
use uv_resolver::{InMemoryIndex, Manifest, Options, Resolver};
use uv_traits::{ConfigSettings, InFlight, NoBuild, SetupPyStrategy};
@ -55,7 +55,7 @@ pub(crate) async fn resolve_cli(args: ResolveCliArgs) -> Result<()> {
let cache = Cache::try_from(args.cache_args)?;
let platform = Platform::current()?;
let venv = Virtualenv::from_env(platform, &cache)?;
let venv = PythonEnvironment::from_virtualenv(platform, &cache)?;
let index_locations = IndexLocations::new(
Some(args.index_url),
args.extra_index_url,

View file

@ -18,7 +18,7 @@ use uv_cache::{Cache, CacheArgs};
use uv_client::{FlatIndex, OwnedArchive, RegistryClient, RegistryClientBuilder};
use uv_dispatch::BuildDispatch;
use uv_installer::NoBinary;
use uv_interpreter::Virtualenv;
use uv_interpreter::PythonEnvironment;
use uv_normalize::PackageName;
use uv_resolver::InMemoryIndex;
use uv_traits::{BuildContext, ConfigSettings, InFlight, NoBuild, SetupPyStrategy};
@ -73,7 +73,7 @@ pub(crate) async fn resolve_many(args: ResolveManyArgs) -> Result<()> {
let total = requirements.len();
let platform = Platform::current()?;
let venv = Virtualenv::from_env(platform, &cache)?;
let venv = PythonEnvironment::from_virtualenv(platform, &cache)?;
let in_flight = InFlight::default();
let client = RegistryClientBuilder::new(cache.clone()).build();