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

Harmonize uv export and uv pip compile comment / output #7159

Closed
apollo13 opened this issue Sep 7, 2024 · 2 comments
Closed

Harmonize uv export and uv pip compile comment / output #7159

apollo13 opened this issue Sep 7, 2024 · 2 comments
Labels
enhancement New feature or improvement to existing functionality

Comments

@apollo13
Copy link

apollo13 commented Sep 7, 2024

Given that uv export and uv pip compile are somewhat able to generate the same output it would be same if their comments and features would match where sensible.

Eg take the following pyproject.toml:

[project]
name = "test"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
    "django>=5.1.1",
]

Running uv export --no-hashes generates:

# This file was autogenerated via `uv export`.
asgiref==3.8.1
django==5.1.1
sqlparse==0.5.1
tzdata==2024.1 ; sys_platform == 'win32'

and running uv pip compile pyproject.toml generates:

# This file was autogenerated by uv via the following command:
#    uv pip compile pyproject.toml
asgiref==3.8.1
    # via django
django==5.1.1
    # via test (pyproject.toml)
sqlparse==0.5.1
    # via django

For consistency it would be great if:

  • The comments both started with This file was autogenerated by uv via the following command:
  • ... and included the full command (like the pip compile example has)
  • Include the "# via" comments in the uv export example. This makes it easier for human to follow why something changed.

The next thing ties into the legacy tooling stuff, but it would be great if it were possible if uv export could generate a non-universal export (like pip compile does by default I assume) so the exported file stays small and comparable.

Happy to answer any questions or elaborate on why I think some things would be useful.

@charliermarsh
Copy link
Member

charliermarsh commented Sep 7, 2024

I think we're unlikely to add all the same adornments to the uv export output (like the # via annotations). It's intentionally not intended to be a format of record, since all of that information lies in the lockfile. We could probably add the command to the header though.

@charliermarsh charliermarsh added the enhancement New feature or improvement to existing functionality label Sep 7, 2024
dcwatson added a commit to dcwatson/uv that referenced this issue Sep 13, 2024
charliermarsh pushed a commit that referenced this issue Sep 13, 2024
## Summary

Updates the output of `uv export` to include the command that produced
it, similar to how `uv pip compile` does. This addresses #7159 - I had
this same itch today, figured it was a good time to dive in!

## Test Plan

All the export unit tests were updated to test the new output format.
@charliermarsh
Copy link
Member

Command will be included in the next release thanks to #7374.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants