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

Fix source annotation in pip compile annotation-style=line output #3637

Merged
merged 1 commit into from
May 17, 2024
Merged

Fix source annotation in pip compile annotation-style=line output #3637

merged 1 commit into from
May 17, 2024

Conversation

blueraft
Copy link
Contributor

Summary

Fixes a small discrepancy between the pip compile outputs for annotation-style=split and annotation-style=line commands.

Problem

Consider the following pyproject.toml file.

$ cat pyproject.toml
[project]
name = "uv_test"
dynamic = ["version"]
dependencies = ["click"]

Running uv pip compile with annotation-style=split on uv 0.1.44 version yields the following:

❯ uv pip compile pyproject.toml --annotation-style=split
Resolved 1 package in 2ms
# This file was autogenerated by uv via the following command:
#    uv pip compile pyproject.toml --annotation-style=split
click==8.1.7
    # via uv-test (pyproject.toml)

However, running uv pip compile with annotation-style=line doesn't include source info for root level dependencies.

❯ uv pip compile pyproject.toml --annotation-style=line
Resolved 1 package in 1ms
# This file was autogenerated by uv via the following command:
#    uv pip compile pyproject.toml --annotation-style=line
click==8.1.7

With this PR:

❯ ../target/debug/uv pip compile --annotation-style=line pyproject.toml
Resolved 1 package in 6ms
# This file was autogenerated by uv via the following command:
#    uv pip compile --annotation-style=line pyproject.toml
click==8.1.7              # via uv-test (pyproject.toml)

This also now matches pip-tools output:

❯ pip-compile --annotation-style=line pyproject.toml
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
#    pip-compile --annotation-style=line pyproject.toml
#
click==8.1.7              # via uv_test (pyproject.toml)

Test Plan

cargo test

@charliermarsh charliermarsh self-requested a review May 17, 2024 13:33
@charliermarsh charliermarsh self-assigned this May 17, 2024
@charliermarsh charliermarsh added the bug Something isn't working label May 17, 2024
Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@charliermarsh charliermarsh merged commit e3e7895 into astral-sh:main May 17, 2024
44 checks passed
@blueraft blueraft deleted the annotate-line-fix branch May 17, 2024 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants