mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
Share flat index across resolutions (#930)
## Summary This PR restructures the flat index fetching in a few ways: 1. It now lives in its own `FlatIndexClient`, since it felt a bit awkward (in my opinion) for it to live in `RegistryClient`. 2. We now fetch the `FlatIndex` outside of the resolver. This has a few benefits: (1) the resolver construct is no longer `async` and no longer returns `Result`, which feels better for a resolver; and (2) we can share the `FlatIndex` across resolutions rather than re-fetching it for every source distribution build.
This commit is contained in:
parent
e6d7124147
commit
42888a9609
16 changed files with 336 additions and 192 deletions
|
@ -15,7 +15,7 @@ use pep508_rs::{MarkerEnvironment, Requirement, StringVersion};
|
|||
use platform_host::{Arch, Os, Platform};
|
||||
use platform_tags::Tags;
|
||||
use puffin_cache::Cache;
|
||||
use puffin_client::RegistryClientBuilder;
|
||||
use puffin_client::{FlatIndex, RegistryClientBuilder};
|
||||
use puffin_interpreter::{Interpreter, Virtualenv};
|
||||
use puffin_resolver::{
|
||||
DisplayResolutionGraph, Manifest, PreReleaseMode, ResolutionGraph, ResolutionMode,
|
||||
|
@ -100,6 +100,7 @@ async fn resolve(
|
|||
tags: &Tags,
|
||||
) -> Result<ResolutionGraph> {
|
||||
let client = RegistryClientBuilder::new(Cache::temp()?).build();
|
||||
let flat_index = FlatIndex::default();
|
||||
let interpreter = Interpreter::artificial(
|
||||
Platform::current()?,
|
||||
markers.clone(),
|
||||
|
@ -118,9 +119,9 @@ async fn resolve(
|
|||
&interpreter,
|
||||
tags,
|
||||
&client,
|
||||
&flat_index,
|
||||
&build_context,
|
||||
)
|
||||
.await?;
|
||||
);
|
||||
Ok(resolver.resolve().await?)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue