uv/crates/uv-resolver
Ahmed Ilyas e3e7895605
Fix source annotation in pip compile annotation-style=line output (#3637)
## 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.
```sh
$ 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:
```sh
❯ 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.
```sh
❯ 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:
```sh
❯ ../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:
```sh
❯ 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`
2024-05-17 09:57:11 -04:00
..
src Fix source annotation in pip compile annotation-style=line output (#3637) 2024-05-17 09:57:11 -04:00
tests Separate cache construction from initialization (#3607) 2024-05-15 12:29:39 -04:00
Cargo.toml Add parsed URL to PubGrubPackage (#3426) 2024-05-14 00:55:21 +00:00