Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor uv-toolchain types #4121

Merged
merged 6 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/bench/benches/uv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn resolve_warm_jupyter(c: &mut Criterion<WallTime>) {
.unwrap();

let cache = &Cache::from_path("../../.cache").init().unwrap();
let venv = PythonEnvironment::from_virtualenv(cache).unwrap();
let venv = PythonEnvironment::from_root("../../.venv", cache).unwrap();
let client = &RegistryClientBuilder::new(cache.clone()).build();
let manifest = &Manifest::simple(vec![Requirement::from(
pep508_rs::Requirement::from_str("jupyter").unwrap(),
Expand Down Expand Up @@ -44,7 +44,7 @@ fn resolve_warm_airflow(c: &mut Criterion<WallTime>) {
.unwrap();

let cache = &Cache::from_path("../../.cache").init().unwrap();
let venv = PythonEnvironment::from_virtualenv(cache).unwrap();
let venv = PythonEnvironment::from_root("../../.venv", cache).unwrap();
let client = &RegistryClientBuilder::new(cache.clone()).build();
let manifest = &Manifest::simple(vec![
Requirement::from(pep508_rs::Requirement::from_str("apache-airflow[all]").unwrap()),
Expand Down
6 changes: 3 additions & 3 deletions crates/uv-dev/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use uv_configuration::{
use uv_dispatch::BuildDispatch;
use uv_git::GitResolver;
use uv_resolver::{FlatIndex, InMemoryIndex};
use uv_toolchain::PythonEnvironment;
use uv_toolchain::Toolchain;
use uv_types::{BuildContext, BuildIsolation, InFlight};

#[derive(Parser)]
Expand Down Expand Up @@ -65,12 +65,12 @@ pub(crate) async fn build(args: BuildArgs) -> Result<PathBuf> {
let index = InMemoryIndex::default();
let index_urls = IndexLocations::default();
let setup_py = SetupPyStrategy::default();
let venv = PythonEnvironment::from_virtualenv(&cache)?;
let toolchain = Toolchain::find_virtualenv(&cache)?;

let build_dispatch = BuildDispatch::new(
&client,
&cache,
venv.interpreter(),
toolchain.interpreter(),
&index_urls,
&flat_index,
&index,
Expand Down
6 changes: 3 additions & 3 deletions crates/uv-dev/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::path::PathBuf;
use clap::Parser;
use tracing::info;
use uv_cache::{Cache, CacheArgs};
use uv_toolchain::PythonEnvironment;
use uv_toolchain::Toolchain;

#[derive(Parser)]
pub(crate) struct CompileArgs {
Expand All @@ -20,8 +20,8 @@ pub(crate) async fn compile(args: CompileArgs) -> anyhow::Result<()> {
let interpreter = if let Some(python) = args.python {
python
} else {
let venv = PythonEnvironment::from_virtualenv(&cache)?;
venv.python_executable().to_path_buf()
let interpreter = Toolchain::find_virtualenv(&cache)?.into_interpreter();
interpreter.sys_executable().to_path_buf()
};

let files = uv_installer::compile_tree(
Expand Down
Loading
Loading