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

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

Open
rosen-dash opened this issue Oct 28, 2024 · 15 comments

Comments

@rosen-dash
Copy link

Originally reported here - pypa/pip#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
Copy link

jmac105 commented Oct 29, 2024

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

rebkwok added a commit to opensafely-core/ehrql that referenced this issue Oct 29, 2024
If the --constraints path is included in a requirements.*.in file,
the absolute path is shown in the comments in the requirements.*.txt
output. This appears to be related to a pip upgrade. Specifying the
--constraints path as a command line arg instead results in the
expected relative paths.

We can likely change back when this issue is addressed:
jazzband/pip-tools#2131
gotmax23 added a commit to gotmax23/ansible-documentation that referenced this issue Oct 29, 2024
@waqas-saeed
Copy link

waqas-saeed commented Oct 29, 2024

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.

felixfontein pushed a commit to ansible/ansible-documentation that referenced this issue Oct 29, 2024
patchback bot pushed a commit to ansible/ansible-documentation that referenced this issue Oct 29, 2024
patchback bot pushed a commit to ansible/ansible-documentation that referenced this issue Oct 29, 2024
patchback bot pushed a commit to ansible/ansible-documentation that referenced this issue Oct 29, 2024
felixfontein pushed a commit to ansible/ansible-documentation that referenced this issue Oct 29, 2024
felixfontein pushed a commit to ansible/ansible-documentation that referenced this issue Oct 29, 2024
samccann pushed a commit to ansible/ansible-documentation that referenced this issue Oct 29, 2024
@AndydeCleyre
Copy link
Contributor

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
Copy link
Contributor

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

said-moj added a commit to ministryofjustice/laa-civil-case-api that referenced this issue Oct 31, 2024
This is due to a bug re-introduced into pip in the last release

jazzband/pip-tools#2131
said-moj added a commit to ministryofjustice/laa-civil-case-api that referenced this issue Oct 31, 2024
This is due to a bug re-introduced into pip in the last release

jazzband/pip-tools#2131
said-moj added a commit to ministryofjustice/laa-civil-case-api that referenced this issue Nov 1, 2024
This is due to a bug re-introduced into pip in the last release

jazzband/pip-tools#2131
said-moj added a commit to ministryofjustice/laa-civil-case-api that referenced this issue Nov 1, 2024
This is due to a bug re-introduced into pip in the last release

jazzband/pip-tools#2131
said-moj added a commit to ministryofjustice/laa-civil-case-api that referenced this issue Nov 1, 2024
This is due to a bug re-introduced into pip in the last release

jazzband/pip-tools#2131
patchback bot pushed a commit to ansible/ansible-documentation that referenced this issue Nov 6, 2024
gotmax23 added a commit to ansible/ansible-documentation that referenced this issue Nov 6, 2024
orfeas-k added a commit to canonical/metacontroller-operator that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'
* Remove unused pytest-lazy-fixture package
* Bump chisme to 0.4.4 to fix #138

Ref canonical/bundle-kubeflow#1177
Ref canonical/bundle-kubeflow#1185
Fixes #138
orfeas-k added a commit to canonical/kubeflow-volumes-operator that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'

Ref canonical/bundle-kubeflow#1177
orfeas-k added a commit to canonical/training-operator that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'

Ref canonical/bundle-kubeflow#1177
orfeas-k added a commit to canonical/resource-dispatcher that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'

Ref canonical/bundle-kubeflow#1177
Ref canonical/bundle-kubeflow#1185
orfeas-k added a commit to canonical/pvcviewer-operator that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'

Ref canonical/bundle-kubeflow#1177
orfeas-k added a commit to canonical/oidc-gatekeeper-operator that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'
* Remove unused pytest-lazy-fixture package

Ref canonical/bundle-kubeflow#1177
Ref canonical/bundle-kubeflow#1185
orfeas-k added a commit to canonical/ngc-integrator-operator that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'

Ref canonical/bundle-kubeflow#1177
orfeas-k added a commit to canonical/dex-auth-operator that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'

Ref canonical/bundle-kubeflow#1177
orfeas-k added a commit to canonical/notebook-operators that referenced this issue Dec 13, 2024
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'
* Remove mocking of private ops class according to canonical/operator#1369 and canonical/seldon-core-operator#268
* Pin blinker due to seleniumbase/SeleniumBase#2782

Ref canonical/bundle-kubeflow#1177
@webknjaz
Copy link
Member

@macro1 the CI is now green and working on PRs unblocked.

raccube added a commit to srobo/helpdesk-system that referenced this issue Dec 23, 2024
orfeas-k added a commit to canonical/knative-operators that referenced this issue Jan 10, 2025
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'
* Remove unused pytest-lazy-fixture package

Ref canonical/bundle-kubeflow#1177
Ref canonical/bundle-kubeflow#1185
@johnraz
Copy link

johnraz commented Jan 15, 2025

@webknjaz is there a consensus for a solution that needs to be worked on?

I can definitely help with a PR but I'd need guidance on what needs to be fixed and I'm confused where to look for more infos.

Thanks !

orfeas-k added a commit to canonical/istio-operators that referenced this issue Jan 16, 2025
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'

Ref canonical/bundle-kubeflow#1177
orfeas-k added a commit to canonical/katib-operators that referenced this issue Jan 16, 2025
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'

Ref canonical/bundle-kubeflow#1177
JannKleen added a commit to coordnet/coordnet that referenced this issue Jan 23, 2025
Note: The absolute paths are due to a bug in pip-compile: jazzband/pip-tools#2131
orfeas-k added a commit to canonical/kfp-operators that referenced this issue Feb 3, 2025
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'
* Remove unused `pytest-lazy-fixture` package


Ref canonical/bundle-kubeflow#1177
Ref canonical/bundle-kubeflow#1185
mvlassis pushed a commit to canonical/resource-dispatcher that referenced this issue Feb 7, 2025
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'

Ref canonical/bundle-kubeflow#1177
Ref canonical/bundle-kubeflow#1185
mvlassis pushed a commit to canonical/metacontroller-operator that referenced this issue Feb 11, 2025
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'
* Remove unused pytest-lazy-fixture package
* Bump chisme to 0.4.4 to fix #138

Ref canonical/bundle-kubeflow#1177
Ref canonical/bundle-kubeflow#1185
Fixes #138
orfeas-k added a commit to canonical/argo-operators that referenced this issue Feb 12, 2025
* Pin pip to 24.2 due to jazzband/pip-tools#2131
* Update python dependencies using 'tox -e update-requirements'

Ref canonical/bundle-kubeflow#1177
@tarasinf
Copy link

I'm curious if there's an update on the timeline for addressing this issue, or if there's a recommended workaround in the meantime?

@webknjaz
Copy link
Member

@johnraz yeah, feel free to send a PR. You'll need to grep the repo for what outputs it and go from there. You'll also need to add tests.

@webknjaz
Copy link
Member

@tarasinf a workaround could be using older pip or post-processing the output with some wrapper. You can also figure out how to fix it and send a pull request.

Timeline: whenever someone sends an acceptable PR, it gets merged and releasing's unblocked.

@tarasinf
Copy link

Thanks.
Here is the workaround I used. It's to lock the pip version only for pip-tools in pre-commit:

  - repo: https://github.com/jazzband/pip-tools
    rev: 7.3.0
    hooks:
      - id: pip-compile
        name: pip-compile requirements-test.in
        args: [requirements/test.in]
        files: ^requirements/(base|test)\.(txt|in)$
        additional_dependencies: ['pip==24.2']

For the test purpose, to be sure pre-commit uses a proper pip version, I used this custom check:

  - repo: local
    hooks:
    - id: pip-version-check
      name: Check pip version
      entry: pip --version
      language: python
      additional_dependencies: ['pip==24.2']
      pass_filenames: false

and run it by pre-commit run --verbose pip-version-chec.

@zachborboacryptofi
Copy link

Timeline: whenever someone sends an acceptable PR, it gets merged and releasing's unblocked.

@webknjaz hi. what's considered an acceptable PR (in addition to the guidelines[1])? does it just need to 1) fix the issue and 2) have a test that demonstrates the issue has been fixed?

[1] https://github.com/jazzband/pip-tools/blob/main/CONTRIBUTING.md

@AndydeCleyre
Copy link
Contributor

FWIW I've just merged latest pip-tools into my relpaths branch (an unacceptable PR), so both that and uv pip compile remain working alternatives. You can test out the branch for example with pipx:

$ pipx run --spec 'pip-tools @ git+https://github.com/AndydeCleyre/pip-tools@feature/relpaths-post-6.8.0' pip-compile requirements.in

@webknjaz
Copy link
Member

@zachborboacryptofi I'd require good test coverage (including local testing against the main branch of pip). The CI should be green. If there's any tests marked as xfail, they'll need to be unmarked. Nothing else comes to my mind. Note that this is maintained sporadically by a bunch of volunteers so don't expect immediate reviews.

@AndydeCleyre could you remind me what's unacceptable in your branch? I vaguely recall you trying something but don't remember the context..

@AndydeCleyre
Copy link
Contributor

@webknjaz While I tried to introduce only as much complexity as needed to reliably track and handle paths, given the constraints of maintaining backward compatibility, and not making changes to pip itself, the final judgment can be found in this comment and the following one.

The highlights are:

. . . these changes are too hacky and bring too much complexity to the codebase.
. . .
I'd rather not have this feature rather than maintain unreliable code.
. . . proposed implementation does touch too much code and adds undesired complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants