Closed jamesmyatt closed 9 months ago
@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.)
Yes. I'm pretty sure it's not a regression.
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?
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
?
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.
Checklist
What is the idea?
Like https://github.com/conda/conda-lock/issues/491 and https://github.com/conda/conda-lock/pull/524, the
kind=env
lock files should also have the entries sorted. This is required to match the output produced byconda 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