Remove lossy resolution-to-requirements conversion in install plan (#7798)

## Summary

This is a longstanding piece of technical debt. After we resolve, we
have a bunch of `ResolvedDist` entries. We then convert those to
`Requirement` (which is lossy -- we lose information like "the index
that the package was resolved to"), and then back to `Dist`.
This commit is contained in:
Charlie Marsh 2024-09-30 10:13:09 -04:00 committed by GitHub
parent dea5aa6b04
commit b6ce39f45e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 175 additions and 347 deletions

View file

@ -213,19 +213,16 @@ impl<'a> BuildContext for BuildDispatch<'a> {
// Determine the current environment markers.
let tags = self.interpreter.tags()?;
let markers = self.interpreter.resolver_markers();
// Determine the set of installed packages.
let site_packages = SitePackages::from_environment(venv)?;
let requirements = resolution.requirements().collect::<Vec<_>>();
let Plan {
cached,
remote,
reinstalls,
extraneous: _,
} = Planner::new(&requirements).build(
} = Planner::new(resolution).build(
site_packages,
&Reinstall::default(),
&BuildOptions::default(),
@ -234,7 +231,6 @@ impl<'a> BuildContext for BuildDispatch<'a> {
self.config_settings,
self.cache(),
venv,
&markers,
tags,
)?;
@ -244,17 +240,6 @@ impl<'a> BuildContext for BuildDispatch<'a> {
return Ok(vec![]);
}
// Resolve any registry-based requirements.
let remote = remote
.iter()
.map(|dist| {
resolution
.get_remote(&dist.name)
.cloned()
.expect("Resolution should contain all packages")
})
.collect::<Vec<_>>();
// Download any missing distributions.
let wheels = if remote.is_empty() {
vec![]