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

Transitive dependency defined with ~= won't generate the latest dependency #2016

Closed jonathan-s closed 9 months ago

jonathan-s commented 9 months ago

If you have a dependency that has it's own dependency and that child dependency is defined with ~= pip-compile won't pick the latest allowable version when you compile the requirements.txt.

Environment Versions

  1. MacOS
  2. 3.8.16
  3. 7.3.0

Steps to replicate

Your project defines dependency A.

Depedency A defines Dependency B like this.

dependency-b~=0.0.1

dependency-b has a later version 0.0.23, using ~= it should install 0.0.23 as that is allowed, thus I would expect pip-compile to generate dependency-b==0.0.23 in the output.

Expected result

See above

Actual result

See above

webknjaz commented 9 months ago

There may be other constraints that lead to this in your deptree. Without a reproducer, there's nothing to discuss, really. We can only tell fortune 🔮 by reading logs and STR 🤷‍♂️

webknjaz commented 9 months ago

A PR with a regression test is welcome — that would clearly document the expectations.

jonathan-s commented 9 months ago

@webknjaz May I ask where at what test suite I should start looking at? Is it test_resolver.py, or somewhere else?

chrysle commented 9 months ago

Is it test_resolver.py

Yes, you can take https://github.com/jazzband/pip-tools/blob/f20d6ae0af45cfeb54e69d7ead9a9d09449b8d5c/tests/test_resolver.py#L448 as a reference.

jonathan-s commented 9 months ago

Thanks for your help. I'm unable to replicate this in tests (it appears everything is working correctly even with Pypi repository). So I'm closing this issue.