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

Lock file for kind=env should be alphabetized #554

Closed
2 tasks done
jamesmyatt opened this issue Nov 20, 2023 · 5 comments · Fixed by #557
Closed
2 tasks done

Lock file for kind=env should be alphabetized #554

jamesmyatt opened this issue Nov 20, 2023 · 5 comments · Fixed by #557

Comments

@jamesmyatt
Copy link
Contributor

jamesmyatt commented Nov 20, 2023

Checklist

  • I added a descriptive title
  • I searched open requests and couldn't find a duplicate

What is the idea?

Like #491 and #524, the kind=env lock files should also have the entries sorted. This is required to match the output produced by conda env export.

Why is this needed?

This enables diff of outputs with conda env export. As well as matching the behaviour of the v2 lock file and producing a stable order.

What should happen?

No response

Additional Context

No response

@jamesmyatt jamesmyatt changed the title Lock file for kind=env should be sorted to match conda env export Lock file for kind=env should be alphabetized Nov 20, 2023
@maresb
Copy link
Contributor

maresb commented Nov 20, 2023

@jamesmyatt, thanks for opening this.

To be clear, this is a feature request and not a bug report, right? (With the release of v2.5.0 today I'm really hoping for no regressions.)

@jamesmyatt
Copy link
Contributor Author

Yes. I'm pretty sure it's not a regression.

@maresb
Copy link
Contributor

maresb commented Nov 20, 2023

Excellent, that's a relief 😅

I think this would be straightforward, and effectively an aesthetic change. Would you be able to write a PR?

If there is one, probably we want to put the pip: list at the end? In that case, I wonder if the - pip item should go in order or above pip:? Probably makes sense to do whatever conda env export does... if it even makes a pip: section at all?

@jamesmyatt
Copy link
Contributor Author

Is it just a matter of putting an if kind == ... around https://github.com/conda/conda-lock/blob/6d1273c079c0ca8d70ee5b355e5a063a0c351ec1/conda_lock/conda_lock.py#L611C1-L611C1 and using lockfile.alphasort_inplace?

@jamesmyatt
Copy link
Contributor Author

conda env export seems to do all of the conda requirements (including pip itself) alphabetically and then all of the pip requirements alphabetically. I think you already have this. It's just a matter of using the method from #524. I think.

jamesmyatt added a commit to jamesmyatt/conda-lock that referenced this issue Dec 13, 2023
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 a pull request may close this issue.

2 participants