-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add to use update code (#1508)
Refactors the `pixi add` code to use the same code path as `update` and `install`. This provides: * A more correct result * Speed, because now everything is done in parallel * Progress Reporting! * Version caps for pypi deps: Fixes: #63 Fixes: #1506 --------- Co-authored-by: Tim de Jager <[email protected]>
- Loading branch information
1 parent
d264c03
commit 5574cbe
Showing
16 changed files
with
695 additions
and
484 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use rattler_conda_types::Platform; | ||
use rattler_lock::{LockFile, LockFileBuilder, Package}; | ||
|
||
use crate::{ | ||
project::{grouped_environment::GroupedEnvironment, Environment}, | ||
HasFeatures, Project, | ||
}; | ||
|
||
/// Constructs a new lock-file where some of the packages have been removed | ||
pub fn filter_lock_file<'p, F: FnMut(&Environment<'p>, Platform, &Package) -> bool>( | ||
project: &'p Project, | ||
lock_file: &LockFile, | ||
mut filter: F, | ||
) -> LockFile { | ||
let mut builder = LockFileBuilder::new(); | ||
|
||
for (environment_name, environment) in lock_file.environments() { | ||
// Find the environment in the project | ||
let Some(project_env) = project.environment(environment_name) else { | ||
continue; | ||
}; | ||
|
||
// Copy the channels | ||
builder.set_channels(environment_name, environment.channels().to_vec()); | ||
|
||
// Copy the indexes | ||
let indexes = environment.pypi_indexes().cloned().unwrap_or_else(|| { | ||
GroupedEnvironment::from(project_env.clone()) | ||
.pypi_options() | ||
.into() | ||
}); | ||
builder.set_pypi_indexes(environment_name, indexes); | ||
|
||
// Copy all packages that don't need to be relaxed | ||
for (platform, packages) in environment.packages_by_platform() { | ||
for package in packages { | ||
if filter(&project_env, platform, &package) { | ||
builder.add_package(environment_name, platform, package); | ||
} | ||
} | ||
} | ||
} | ||
|
||
builder.finish() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.