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

Allowing pre-release for only one package #2059

Closed AntoineD closed 6 months ago

AntoineD commented 6 months ago

Consider a package A that depends on package B, I want the develop branch of the package A to be tested against the develop branch of the package B. Following #1920, the workaround I found to create a lock file is to host the development version of package B on a dedicated package index then pass this extra index and the flag --pre to pip-compile.

But this allows pre-release versions for any packages instead of only allowing it for package B.

How could this be achieved?

chrysle commented 6 months ago

Have you also considered pinning the pre-release version of package B in requirements.in? Apart from that, pre-release settings are only considered globally by pip in lockfiles.

webknjaz commented 6 months ago

For such case, I'd recommend adding something like -c curated-pins.in on top of requirements.in and maintaining hand-crafted entries of everything you're interested curated-pins.in. Though, this needs testing, it might need a -r.

From a high-level perspective, though, there's currently no user-facing mechanism in pip for this that would support this use-case, short of specifying a pre-release version in the user request like pip install 'pkg-B >= 0.0.0a0'. The same should work in in the metadata of your pkg-A. PEP 440 doesn't really spell out how the installers should handle this: https://packaging.python.org/en/latest/specifications/version-specifiers/#handling-of-pre-releases.

AntoineD commented 6 months ago

It works fine, thank you all.