-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: validate machine using lockfile #2849
base: main
Are you sure you want to change the base?
feat: validate machine using lockfile #2849
Conversation
@@ -249,7 +244,6 @@ fn command_not_found<'p>(project: &'p Project, explicit_environment: Option<Envi | |||
project | |||
.environments() | |||
.into_iter() | |||
.filter(|env| verify_current_platform_has_required_virtual_packages(env).is_ok()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this causes all tasks to be shown regardless of whether the current system supports it. Should we maybe call a function here to check that?
src/cli/task.rs
Outdated
if verify_current_platform_has_required_virtual_packages(env).is_ok() { | ||
Some((env.clone(), env.get_filtered_tasks())) | ||
} else { | ||
None | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as my comment above, perhaps we can call a function to see if a certain environment is supported by the current platform.
@@ -465,12 +458,7 @@ fn build_env_feature_task_map(project: &Project) -> Vec<EnvTasks> { | |||
.environments() | |||
.iter() | |||
.sorted_by_key(|env| env.name().to_string()) | |||
.filter_map(|env: &Environment<'_>| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
src/lock_file/virtual_packages.rs
Outdated
let conda_records = environment | ||
.conda_repodata_records(platform) | ||
.map_err(VirtualPackageError::RepodataConversionError)? | ||
.ok_or(VirtualPackageError::NoCondaRecordsFound(platform))? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that bad? It means there is an environment but that specific environment is empty. I guess its installable then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually have a legitimate use case for empty environments: tasks that use software not managed by pixi.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should indeed not error on an empty environment, I'm also a big user of that as a feature ;)
@@ -150,11 +148,6 @@ impl<'p, D: TaskDisambiguation<'p>> SearchEnvironments<'p, D> { | |||
.iter() | |||
// Filter out default environment | |||
.filter(|env| !env.name().is_default()) | |||
// Filter out environments that can not run on this machine. | |||
.filter(|env| { | |||
self.ignore_system_requirements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be added back somehow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I currently implemented it in such a way that it only checks the platform but this would ambigue the cuda
vs non cuda
tasks.... I think I'll still have to fix that.
Why:
This PR tries to make the running of environments more flexible. The
system-requirements
were previously checked before you could run an environment. This PR changes that to only allow installation of a prefix if all virtual packages are matched with the requirements in the lockfile. This results in a less strict rule, as we don't let the user the requirements (Now this became an even worse name).Resulting in the following benefits:
cuda
would still allow an environment to be installed on Mac.system-requirement
while there aren't actually packages that require it, allows the user to still run it.Manifests that will now work but didn't work before:
Draft because:
PyPI
also needs logic to validate the wheel tags against the machine.test:extra_slow