Skip to content

Commit

Permalink
Remove unused base_python from BuildDispatch (astral-sh#2004)
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Feb 27, 2024
1 parent 5997d0d commit 3417330
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 30 deletions.
1 change: 0 additions & 1 deletion crates/uv-dev/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ pub(crate) async fn build(args: BuildArgs) -> Result<PathBuf> {
&flat_index,
&index,
&in_flight,
venv.python_executable(),
setup_py,
&config_settings,
&NoBuild::None,
Expand Down
1 change: 0 additions & 1 deletion crates/uv-dev/src/install_many.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ pub(crate) async fn install_many(args: InstallManyArgs) -> Result<()> {
&flat_index,
&index,
&in_flight,
venv.python_executable(),
setup_py,
&config_settings,
&no_build,
Expand Down
1 change: 0 additions & 1 deletion crates/uv-dev/src/resolve_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ pub(crate) async fn resolve_cli(args: ResolveCliArgs) -> Result<()> {
&flat_index,
&index,
&in_flight,
venv.python_executable(),
SetupPyStrategy::default(),
&config_settings,
&no_build,
Expand Down
1 change: 0 additions & 1 deletion crates/uv-dev/src/resolve_many.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ pub(crate) async fn resolve_many(args: ResolveManyArgs) -> Result<()> {
&flat_index,
&index,
&in_flight,
venv.python_executable(),
setup_py,
&config_settings,
&no_build,
Expand Down
19 changes: 6 additions & 13 deletions crates/uv-dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
//! implementing [`BuildContext`].

use std::future::Future;
use std::path::{Path, PathBuf};
use std::path::Path;

use anyhow::{bail, Context, Result};
use futures::FutureExt;
use itertools::Itertools;
use tracing::{debug, instrument};

use distribution_types::{IndexLocations, Name, Resolution, SourceDist};
use futures::FutureExt;
use pep508_rs::Requirement;
use uv_build::{SourceBuild, SourceBuildContext};
use uv_cache::Cache;
Expand All @@ -30,7 +30,6 @@ pub struct BuildDispatch<'a> {
flat_index: &'a FlatIndex,
index: &'a InMemoryIndex,
in_flight: &'a InFlight,
base_python: PathBuf,
setup_py: SetupPyStrategy,
no_build: &'a NoBuild,
no_binary: &'a NoBinary,
Expand All @@ -49,7 +48,6 @@ impl<'a> BuildDispatch<'a> {
flat_index: &'a FlatIndex,
index: &'a InMemoryIndex,
in_flight: &'a InFlight,
base_python: PathBuf,
setup_py: SetupPyStrategy,
config_settings: &'a ConfigSettings,
no_build: &'a NoBuild,
Expand All @@ -63,7 +61,6 @@ impl<'a> BuildDispatch<'a> {
flat_index,
index,
in_flight,
base_python,
setup_py,
config_settings,
no_build,
Expand Down Expand Up @@ -91,10 +88,6 @@ impl<'a> BuildContext for BuildDispatch<'a> {
self.interpreter
}

fn base_python(&self) -> &Path {
&self.base_python
}

fn no_build(&self) -> &NoBuild {
self.no_build
}
Expand All @@ -103,14 +96,14 @@ impl<'a> BuildContext for BuildDispatch<'a> {
self.no_binary
}

fn setup_py_strategy(&self) -> SetupPyStrategy {
self.setup_py
}

fn index_locations(&self) -> &IndexLocations {
self.index_locations
}

fn setup_py_strategy(&self) -> SetupPyStrategy {
self.setup_py
}

async fn resolve<'data>(&'data self, requirements: &'data [Requirement]) -> Result<Resolution> {
let markers = self.interpreter.markers();
let tags = self.interpreter.tags()?;
Expand Down
4 changes: 0 additions & 4 deletions crates/uv-resolver/tests/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ impl BuildContext for DummyContext {
&self.interpreter
}

fn base_python(&self) -> &Path {
panic!("The test should not need to build source distributions")
}

fn no_build(&self) -> &NoBuild {
&NoBuild::None
}
Expand Down
5 changes: 1 addition & 4 deletions crates/uv-traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ pub trait BuildContext: Sync {
/// it's metadata (e.g. wheel compatibility tags).
fn interpreter(&self) -> &Interpreter;

/// The system (or conda) python interpreter to create venvs.
fn base_python(&self) -> &Path;

/// Whether source distribution building is disabled. This [`BuildContext::setup_build`] calls
/// will fail in this case. This method exists to avoid fetching source distributions if we know
/// we can't build them
Expand All @@ -89,7 +86,7 @@ pub trait BuildContext: Sync {
) -> impl Future<Output = Result<Resolution>> + Send + 'a;

/// Install the given set of package versions into the virtual environment. The environment must
/// use the same base python as [`BuildContext::base_python`]
/// use the same base Python as [`BuildContext::interpreter`]
fn install<'a>(
&'a self,
resolution: &'a Resolution,
Expand Down
1 change: 0 additions & 1 deletion crates/uv/src/commands/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ pub(crate) async fn pip_compile(
&flat_index,
&source_index,
&in_flight,
interpreter.sys_executable().to_path_buf(),
setup_py,
&config_settings,
no_build,
Expand Down
2 changes: 0 additions & 2 deletions crates/uv/src/commands/pip_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ pub(crate) async fn pip_install(
&flat_index,
&index,
&in_flight,
venv.python_executable(),
setup_py,
config_settings,
no_build,
Expand Down Expand Up @@ -255,7 +254,6 @@ pub(crate) async fn pip_install(
&flat_index,
&index,
&in_flight,
venv.python_executable(),
setup_py,
config_settings,
no_build,
Expand Down
1 change: 0 additions & 1 deletion crates/uv/src/commands/pip_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ pub(crate) async fn pip_sync(
&flat_index,
&index,
&in_flight,
venv.python_executable(),
setup_py,
config_settings,
no_build,
Expand Down
1 change: 0 additions & 1 deletion crates/uv/src/commands/venv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ async fn venv_impl(
&flat_index,
&index,
&in_flight,
venv.python_executable(),
SetupPyStrategy::default(),
&config_settings,
&NoBuild::All,
Expand Down

0 comments on commit 3417330

Please sign in to comment.