-
Notifications
You must be signed in to change notification settings - Fork 314
feat(import): implement pixi import
for environment.yml
#4096
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
base: main
Are you sure you want to change the base?
Conversation
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.
Looks like a good start!
c7b296b
to
b13d8a6
Compare
It sounds like we are initially interested in attempting to process these file types as these formats:
Option 1: just have
Is it a problem if one cannot force only trying Option 2: just have a
Alternative suggestions:
What do you think @Hofer-Julian @baszalmstra ? |
Nice write-up @lucascolley! Seeing it written out like this, option 2 seems like the way to go.
What I like about 2. is that we can also sync the behavior with |
@Hofer-Julian could you check whether these tests are along the right lines? If so, probably just a few more edge cases to cover, as well as implementing handling for |
The tests look good, great work! |
Added a test for that just now — I think this is all ready from my side! We can save converting |
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 should add some docs as well to explain how the parameters interact
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.
@nichmor perhaps you could take a look at this PR while Julian is at EuroPython?
for spec in conda_deps { | ||
// Determine the name of the package to add | ||
let (Some(package_name), spec) = spec.clone().into_nameless() else { | ||
miette::bail!( | ||
"{} does not support wildcard dependencies", | ||
pixi_utils::executable_name() | ||
); | ||
}; | ||
let spec = PixiSpec::from_nameless_matchspec(spec, &channel_config); | ||
workspace.manifest().add_dependency( | ||
&package_name, | ||
&spec, | ||
SpecType::Run, | ||
&platforms, | ||
&feature_name, | ||
DependencyOverwriteBehavior::Overwrite, | ||
)?; | ||
} | ||
for requirement in pypi_deps { | ||
workspace.manifest().add_pep508_dependency( | ||
(&requirement, None), | ||
&platforms, | ||
&feature_name, | ||
None, | ||
DependencyOverwriteBehavior::Overwrite, | ||
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.
this is a modified version of
Lines 322 to 351 in 6359d0a
for spec in conda_deps { | |
// Determine the name of the package to add | |
let (Some(name), spec) = spec.clone().into_nameless() else { | |
miette::bail!( | |
"{} does not support wildcard dependencies", | |
pixi_utils::executable_name() | |
); | |
}; | |
let spec = PixiSpec::from_nameless_matchspec(spec, &channel_config); | |
workspace.manifest().add_dependency( | |
&name, | |
&spec, | |
SpecType::Run, | |
// No platforms required as you can't define them in the yaml | |
&[], | |
&FeatureName::default(), | |
DependencyOverwriteBehavior::Overwrite, | |
)?; | |
} | |
for requirement in pypi_deps { | |
workspace.manifest().add_pep508_dependency( | |
(&requirement, None), | |
// No platforms required as you can't define them in the yaml | |
&[], | |
&FeatureName::default(), | |
None, | |
DependencyOverwriteBehavior::Overwrite, | |
None, | |
)?; | |
} |
Could maybe be refactored out to a new function.
closes gh-4085
TODO:
file.variables()
(in a follow-up feat(import): WIP supportvariables
for conda-env format #4103)