Migrate interpreter query to custom caching (#508)

This removes the last usage of cacache by replacing it with a custom,
flat json caching keyed by the digest of the executable path.


![image](8f777c4c-1f1b-4656-ba7b-002175270556)

A step towards #478. I've made `CachedByTimestamp<T>` generic over `T`
but intentionally not moved it to `puffin-cache` yet.
This commit is contained in:
konsti 2023-11-28 18:14:59 +01:00 committed by GitHub
parent 5435d44756
commit d89fbeb642
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 88 additions and 156 deletions

View file

@ -39,7 +39,6 @@ requirements-txt = { path = "../requirements-txt" }
anstream = { workspace = true }
anyhow = { workspace = true }
bitflags = { workspace = true }
cacache = { workspace = true }
chrono = { workspace = true }
clap = { workspace = true, features = ["derive"] }
colored = { workspace = true }

View file

@ -8,7 +8,7 @@ use miette::{Diagnostic, IntoDiagnostic};
use thiserror::Error;
use platform_host::Platform;
use puffin_cache::{Cache, CacheBucket};
use puffin_cache::Cache;
use puffin_interpreter::Interpreter;
use crate::commands::ExitStatus;
@ -77,12 +77,8 @@ fn venv_impl(
};
let platform = Platform::current().into_diagnostic()?;
let interpreter_info = Interpreter::query(
&base_python,
platform,
&cache.bucket(CacheBucket::Interpreter),
)
.map_err(VenvError::InterpreterError)?;
let interpreter_info =
Interpreter::query(&base_python, platform, cache).map_err(VenvError::InterpreterError)?;
writeln!(
printer,