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.67k stars 608 forks source link

`pip-compile requirements.in` produces a different output than the pre-commit hook. #2034

Closed PawelPawlikMIM closed 6 months ago

PawelPawlikMIM commented 8 months ago

In version 7.3.0 pip-compile requirements.in produces a different output than the pre-commit hook. The is no issue after downgrading to 7.2.0.

Environment Versions

  1. OS Type: Ubuntu 20.04.3 LTS
  2. Python version: Python 3.9.5
  3. pip version: pip 23.3
  4. pip-tools version: 7.3.0

Steps to replicate

  1. requirements.in content:
    selenium==4.14.0
  2. .pre-commit-config.yaml content:
    repos:
    - repo: https://github.com/jazzband/pip-tools
    rev: 7.3.0
    hooks:
      - id: pip-compile
        files: ^requirements\.(in|txt)$
        args: [requirements.in]
  3. commit requirements.in file
  4. run pip-compile requirements.in

Expected result

requirements.txt should remain unchanged when running the 4th step.

Actual result

requirements.txt differs. diff output:

 urllib3[socks]==1.26.16
-    # via selenium
+    # via
+    #   selenium
+    #   urllib3
 wsproto==1.2.0
AndydeCleyre commented 8 months ago

Thanks!

This may be a dup of #2003 and fixed by #2011, which is merged but not yet in a release.

MartinRoth commented 8 months ago

Hi, thanks for the great work! I am also awaiting the release with #2011 included.

jonesbusy commented 7 months ago

Same issue here

MartinRoth commented 7 months ago

For me it works again with the newest pip...

jonesbusy commented 7 months ago

If I rollback to pip 23.2.1 everything is back to normal

At the end I'm not sure what should be fixed where (pip ? pip-tool ?)

I tried to play with --strip-extras, but I always end-up with compatibility issue between precommit, pip-compile and renovate tooling

MartinRoth commented 7 months ago

If I rollback to pip 23.2.1 everything is back to normal

At the end I'm not sure what should be fixed where (pip ? pip-tool ?)

I tried to play with --strip-extras, but I always end-up with compatibility issue between precommit, pip-compile and renovate tooling

I am using pip==23.3.2 and pip-tools==7.3.0 and it works as well. However, I feel your confusion.

MartinRoth commented 6 months ago

Since the upgrade to pip==24.0.0 I have this issue again 😒

AndydeCleyre commented 6 months ago

@MartinRoth Do you have the issue with pip-tools >= 7.4.0?

MartinRoth commented 6 months ago

Hi @AndydeCleyre, currently I am using pip-tools==7.4.0 and pip==24.0 and it seems to work again.

webknjaz commented 6 months ago

Thanks! Considering this resolved, then.

jonesbusy commented 6 months ago

I confirm also with latest using pip-tools 7.4.0, pip 24.0 and latest renovate 37.218.0 I don't see anymore any compatiblity issue. Thanks!