jazzband / pip-tools

A set of tools to keep your pinned Python dependencies fresh.
https://pip-tools.rtfd.io
BSD 3-Clause "New" or "Revised" License
7.74k stars 612 forks source link

Files included relatively in requirements.in file gets converted to absolute paths #2131

Open rosen-dash opened 2 days ago

rosen-dash commented 2 days ago

Originally reported here - https://github.com/pypa/pip/issues/13055

Environment Versions

  1. OS Type: MacOS 15.0.1, Ubuntu 24.04
  2. Python version: $ python -V Python 3.9.6
  3. pip version: $ pip --version pip 24.3.1
  4. pip-tools version: $ pip-compile --version 7.4.1

Steps to replicate

Sample repo in referred issue.

With pip 24.2

backoff==2.2.1
    # via -r requirements.in

With pip 24.3.1

backoff==2.2.1
    # via -r /Users/rosen/Personal/sample/requirements.in

Expected result

The relative references should be preserved

Actual result

Relative paths get replaced with absolute paths

jmac105 commented 2 days ago

Same happens if specifying a constraint file inside requirements.in, such as -c requirements.txt. However if the constraint file is set via command-line argument instead, like pip-compile -c requirements.txt then the annotation uses the relative path instead.

Can replicate with pip 24.3 too, suspect this is a consequence of this change? https://github.com/pypa/pip/pull/12877/files#diff-e9f0a8e3da86978e2042a5a8073078ae9e37ee041dbc943c066e0c622c52d0d4

waqas-saeed commented 1 day ago

like @jmac105 said I can confirm this is caused by pip 24.3.1. if I use a bit older pip version like 23.0.1 then pip-compile shows relative path.

AndydeCleyre commented 1 day ago

FWIW this is not an issue in my feature/relpaths-post-6.8.0 branch, but there are no plans to integrate those changes here.

AndydeCleyre commented 1 day ago

Alternatively, it's not a problem with uv pip compile, either.