mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
Use borrowed data in BuildDispatch
(#679)
This PR uses borrowed data in `BuildDispatch` which makes creating a `BuildDispatch` extremely cheap (only one allocation, for the Python executable). I can be talked out of this, it will have no measurable impact.
This commit is contained in:
parent
c400ab7d07
commit
dbf055fe6f
7 changed files with 94 additions and 101 deletions
|
@ -139,12 +139,12 @@ pub(crate) async fn pip_compile(
|
|||
|
||||
let options = ResolutionOptions::new(resolution_mode, prerelease_mode, exclude_newer);
|
||||
let build_dispatch = BuildDispatch::new(
|
||||
client.clone(),
|
||||
cache.clone(),
|
||||
interpreter,
|
||||
&client,
|
||||
&cache,
|
||||
&interpreter,
|
||||
&index_urls,
|
||||
venv.python_executable(),
|
||||
no_build,
|
||||
index_urls,
|
||||
)
|
||||
.with_options(options);
|
||||
|
||||
|
|
|
@ -133,12 +133,12 @@ pub(crate) async fn pip_install(
|
|||
let options = ResolutionOptions::new(resolution_mode, prerelease_mode, exclude_newer);
|
||||
|
||||
let build_dispatch = BuildDispatch::new(
|
||||
client.clone(),
|
||||
cache.clone(),
|
||||
interpreter,
|
||||
&client,
|
||||
&cache,
|
||||
&interpreter,
|
||||
&index_urls,
|
||||
venv.python_executable(),
|
||||
no_build,
|
||||
index_urls.clone(),
|
||||
)
|
||||
.with_options(options);
|
||||
|
||||
|
@ -200,7 +200,7 @@ pub(crate) async fn pip_install(
|
|||
site_packages,
|
||||
reinstall,
|
||||
link_mode,
|
||||
index_urls,
|
||||
&index_urls,
|
||||
&tags,
|
||||
&client,
|
||||
&build_dispatch,
|
||||
|
@ -264,7 +264,7 @@ async fn build_editables(
|
|||
cache: &Cache,
|
||||
tags: &Tags,
|
||||
client: &RegistryClient,
|
||||
build_dispatch: &BuildDispatch,
|
||||
build_dispatch: &BuildDispatch<'_>,
|
||||
mut printer: Printer,
|
||||
) -> Result<Vec<BuiltEditable>, Error> {
|
||||
let start = std::time::Instant::now();
|
||||
|
@ -321,7 +321,7 @@ async fn resolve(
|
|||
tags: &Tags,
|
||||
markers: &MarkerEnvironment,
|
||||
client: &RegistryClient,
|
||||
build_dispatch: &BuildDispatch,
|
||||
build_dispatch: &BuildDispatch<'_>,
|
||||
options: ResolutionOptions,
|
||||
mut printer: Printer,
|
||||
) -> Result<ResolutionGraph, Error> {
|
||||
|
@ -386,10 +386,10 @@ async fn install(
|
|||
site_packages: SitePackages<'_>,
|
||||
reinstall: &Reinstall,
|
||||
link_mode: LinkMode,
|
||||
index_urls: IndexUrls,
|
||||
index_urls: &IndexUrls,
|
||||
tags: &Tags,
|
||||
client: &RegistryClient,
|
||||
build_dispatch: &BuildDispatch,
|
||||
build_dispatch: &BuildDispatch<'_>,
|
||||
cache: &Cache,
|
||||
venv: &Virtualenv,
|
||||
mut printer: Printer,
|
||||
|
@ -413,7 +413,7 @@ async fn install(
|
|||
editables,
|
||||
site_packages,
|
||||
reinstall,
|
||||
&index_urls,
|
||||
index_urls,
|
||||
cache,
|
||||
venv,
|
||||
tags,
|
||||
|
|
|
@ -62,12 +62,12 @@ pub(crate) async fn pip_sync(
|
|||
|
||||
// Prep the build context.
|
||||
let build_dispatch = BuildDispatch::new(
|
||||
client.clone(),
|
||||
cache.clone(),
|
||||
venv.interpreter().clone(),
|
||||
&client,
|
||||
&cache,
|
||||
venv.interpreter(),
|
||||
&index_urls,
|
||||
venv.python_executable(),
|
||||
no_build,
|
||||
index_urls.clone(),
|
||||
);
|
||||
|
||||
// Determine the set of installed packages.
|
||||
|
@ -341,7 +341,7 @@ async fn resolve_editables(
|
|||
tags: &Tags,
|
||||
cache: &Cache,
|
||||
client: &RegistryClient,
|
||||
build_dispatch: &BuildDispatch,
|
||||
build_dispatch: &BuildDispatch<'_>,
|
||||
mut printer: Printer,
|
||||
) -> Result<ResolvedEditables> {
|
||||
// Partition the editables into those that are already installed, and those that must be built.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue