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

Ensure lockfile is preserved when dumping model #6

Merged

Conversation

soapy1
Copy link

@soapy1 soapy1 commented Nov 19, 2024

fixes conda-incubator#986
related to conda-incubator#985

Description

The issue described in conda-incubator#986 is (in part) caused by https://github.com/conda-incubator/conda-store/blob/main/conda-store-server/conda_store_server/_internal/server/views/api.py#L883-L890 where the lockfile spec is loaded into the LockfileSpecification model. When this happens, some of the fields from the lockfile disappear.

This happens here because in updating pydantic the way the model was getting dumped also was updated. Moving from calling the dict function to the model_dump function. For example in https://github.com/conda-incubator/conda-store/pull/985/files#diff-91666c161b2c4e479323a0d582f7ab9198bcc1523739281e191fb433fbb4c69bR85. Usingmodel_dump directly skips using conda-lock's dict_for_output function, which is required for properly dumping the model.

By ensuring that the conda lock dict_for_output is used to dump the LockfileSpecification model, the issue described in conda-incubator#986 is resolved

Pull request checklist

  • Did you test this change locally?
  • Did you update the documentation (if required)?
  • Did you add/update relevant tests for this change (if required)?

@soapy1 soapy1 force-pushed the fix-lockfile-spec-test branch from 5ab62cc to b5d15d4 Compare November 22, 2024 18:17
conda-lock needs to output using the "output_for_dict" function.
So, the LockfileSpecification should provide this as the default
way to dump the model.
@soapy1 soapy1 force-pushed the fix-lockfile-spec-test branch from b5d15d4 to 237d7e3 Compare November 22, 2024 18:25
@soapy1 soapy1 marked this pull request as ready for review November 22, 2024 18:26
@peytondmurray peytondmurray merged commit f90213e into peytondmurray:984-update-pydantic Nov 22, 2024
15 of 18 checks passed
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