Skip to content
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: added experimental fields to conda lock #221

Merged
merged 7 commits into from
Jun 22, 2023

Conversation

tdejager
Copy link
Collaborator

So that it is possible to re-create a package record from a locked package

Copy link
Collaborator

@baszalmstra baszalmstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! But could you also implement From<RepoDataRecord> and vice versa for LockedPackage? Then we are sure it will work!

@@ -263,6 +264,52 @@ pub struct LockedDependency {
pub source: Option<Url>,
/// Build string
pub build: Option<String>,

/// Experimental: architecture field
#[serde(skip_serializing_if = "Option::is_none")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use:

https://docs.rs/serde_with/3.0.0/serde_with/attr.skip_serializing_none.html

To avoid having to repeat this everywhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@tdejager
Copy link
Collaborator Author

I think I'm unable to implement From directly seeing as some fields can be None but not are not None in LockedPackage. For example the hashes are both options in PackageRecord but is an enum in LockedPackage. So I propose just to add some conversion methods, that return a Result for this.

@baszalmstra
Copy link
Collaborator

You could also implement TryFrom where the conversion could fail

@tdejager
Copy link
Collaborator Author

Did all that please check it again :) @baszalmstra

@baszalmstra baszalmstra merged commit a08f0ec into main Jun 22, 2023
@baszalmstra baszalmstra deleted the feat/experimental-conda-lock branch June 22, 2023 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants