Summarize package changes in uv sync json format output#16981
Conversation
|
So, to summarise a discussion from Discord, a suggestion was made to pull out the planning step from The goal being that a I've started to explore the idea of pulling out |
|
So, the idea behind $ uv sync
Resolved 6 packages in 2ms
Uninstalled 4 packages in 5ms
Installed 3 packages in 8ms
- anyio==4.12.0
+ charset-normalizer==3.4.4
- h11==0.16.0
- httpcore==1.0.9
- httpx==0.28.1
+ requests==2.32.5
+ urllib3==2.5.0
$ magically_revert_state # Trade secret
$ uv sync --dry-run
Would use project environment at: .venv
Resolved 6 packages in 1ms
Found up-to-date lockfile at: uv.lock
Would uninstall 4 packages
Would install 3 packages
- anyio==4.12.0
+ charset-normalizer==3.4.4
- h11==0.16.0
- httpcore==1.0.9
- httpx==0.28.1
+ requests==2.32.5
+ urllib3==2.5.0And the goal of the json output is to present this information in JSON. In the output above, the normal path uses I think the only real changes which would be required is to: Expand the kinds of dists that Finally, I believe this can all be done while keeping things pretty clean. Definitely no Let me know what you think. Footnotes
|
|
Sounds fine to me! |
c590698 to
b2a9a0a
Compare
## Summary Remove duplication in `report_dry_run` by making `Changelog` support both local and remote dists. This is in support of #16653 and will form a new basis for #16981. This also involved refactoring `InstallLogger` and its implementations to support dry run logging. Additionally includes some minor refactoring in `SummaryInstallLogger` and a fix to `InstalledVersion`. See https://github.com/astral-sh/uv/compare/tk/dry-run-refactor for an alternative approach (although obviously comes with some caveats). ## Test Plan There are already quite a few tests which cover the output and they pass. Manual testing was used to ensure styling stayed consistent.
b2a9a0a to
cc91e47
Compare
|
Okay, rebased on top of the new changelog stuff, fixed the package naming and attaching the wrong lifetime to a reference in |
cd07f42 to
f026d17
Compare
Summary
Implement #16653 by making
uv sync --output-format=jsonoutput information about package changes.Test Plan
Additional tests to test the cases where there is no known package version may be beneficial but as the information used is the same as the information used by the dry run logging now, I don't think that's strictly necessary as those cases are tested.