-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add ability to create environment from lockfile #395
Conversation
src/features/environmentCreate/components/Specification/SpecificationCreate.tsx
Show resolved
Hide resolved
@@ -6,4 +6,5 @@ export type CondaSpecification = { | |||
dependencies: (string | CondaSpecificationPip)[]; | |||
variables: Record<string, string>; | |||
prefix?: string | null; | |||
lockfile?: any | null; |
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 don't want to rely on any particular format here since it might change upstream.
spec?.lockfile?.metadata?.channels?.map( | ||
(channel: any) => channel?.url | ||
) ?? | ||
[]; |
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 and similar code for deps is what populates GUI channels and dependencies lists on env save.
metadata: {}, | ||
package: [] | ||
}); | ||
}; |
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 just to hint to the user which lockfile format is expected. Similar idea to formatCode
above.
@@ -0,0 +1,41 @@ | |||
import { createSlice } from "@reduxjs/toolkit"; |
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 file is the same idea as src/features/environmentVariables/environmentVariablesSlice.ts
.
spec?.lockfile?.package | ||
?.filter((p: any) => p?.manager === "conda") | ||
?.map((p: any) => `${p?.name}==${p?.version}`) ?? | ||
[]; |
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 only list conda packages and ignore pip because conda-store does the same for ordinary specs as well.
displayEmpty | ||
> | ||
<MenuItem value="specification">specification</MenuItem> | ||
<MenuItem value="lockfile">unified lockfile</MenuItem> |
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.
MenuItem values here match those we show in the admin interface (see the companion conda-store PR).
@gabalafou @peytondmurray PTAL. I'm currently on PTO, feel free to take over if this requires changes. |
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 pushed a few small changes.
I tested locally by copy-pasting lockfile from one environment to create another.
I feel that we should add a note to the UI that explains that GUI-Lockfile syncing has not been implemented. Otherwise I think an end user will find the app behavior confusing. I'll add that in a subsequent commit and then I think this should be good to go.
I just chatted with @trallard about this. I'm not sure we can move forward with this PR. This PR implements a UI that suggests to the end user that they can manually edit a lockfile, which can lead to very unintuitive behavior. For example (one we tested), if a user updates the It seems that the correct implementation here should be a file upload button for the lockfile, not exposing it in the code editor. |
Based on sprint planning meeting today, I'm closing this PR without merging because I will re-implement the UX for "create environment from a lockfile" as a file upload instead. |
This is a companion PR for conda-incubator/conda-store#772.
Description
This pull request: adds a new dropdown in the YAML window, which allows creating an env from a lockfile.
The supported lockfile type is https://conda.github.io/conda-lock/output/#unified-lockfile, which is also generated by conda-store as the lockfile build artifact.
Pull request checklist
Additional information
Where to get a lockfile for testing:
Manual tests:
Future work: