feat: implement uv-style dependency sorting and multiline formatting#5677
feat: implement uv-style dependency sorting and multiline formatting#5677kajal-jotwani wants to merge 14 commits intoprefix-dev:mainfrom
Conversation
|
Can you add unit tests specifically for |
Thanks for the review! I’ve added unit tests for |
|
@baszalmstra could you please take a look at this whenever you get a chance Thanks! |
|
I have updated tests to use |
baszalmstra
left a comment
There was a problem hiding this comment.
Please use inline snapshots, that makes it easier to see the result in the test itself.
Done! will keep this in mind next time. |
Description
When running
pixi add --pypiwith multiple packages, dependencies were previously written as inline arrays with inconsistent ordering, which could create unnecessary diffs when removing and re-adding packages.This PR updates PyPI dependency formatting to follow uv-style behavior:
The multiline formatting logic is adapted from uv’s reformat_array_multiline, which preserves inline and trailing comments.
Fixes #5651
How Has This Been Tested?
Added three unit tests covering sorting behavior, multiline formatting, and the remove-and-readd zero-diff case. Snapshot tests were updated accordingly.
AI Disclosure
Tools: {e.g., Claude, Codex, GitHub Copilot, ChatGPT, etc.}
Checklist:
schema/model.py.