pip icon indicating copy to clipboard operation
pip copied to clipboard

Final and prerelease control for package selection

Open notatallshaw opened this issue 1 month ago • 1 comments

Fixes https://github.com/pypa/pip/issues/13221

This PR adds two new flags --all-releases and --only-final, they control package selection with the exact same semantics as --no-binary and --only-binary, but for pre vs final releases instead of binary vs. source distributions.

They are mutually exclusive with --pre, as there are edge cases to do with the semantics of --pre and these flags I didn't want to have to define. However, when only --pre is used it is converted to the equivalent --all-releases :all: in the code, to keep the logic simple.

The main feature I think users will be interested is only allowing final releases, to prevent pre-releases from being selected in any situation, e.g.

$ pip install --dry-run opentelemetry-exporter-prometheus  --only-final ":all:"
ERROR: Ignored the following yanked versions: 1.10a0, 1.12.0rc1
ERROR: Could not find a version that satisfies the requirement opentelemetry-exporter-prometheus (from versions: 0.12b0, 0.13b0, 0.14b0, 0.15b0, 0.16b0, 0.16b1, 0.17b0, 0.29b0, 0.30b0, 0.30b1, 0.32b0, 0.33b0, 0.34b0, 0.35b0, 0.36b0, 0.37b0, 0.38b0, 0.39b0, 0.40b0, 0.41b0, 0.42b0, 0.43b0, 0.44b0, 0.45b0, 0.46b0, 0.47b0, 0.48b0, 0.49b0, 0.49b1, 0.49b2, 0.50b0, 0.51b0, 0.52b0, 0.52b1, 0.53b0, 0.53b1, 0.54b0, 0.54b1, 0.55b0, 0.55b1, 0.56b0, 0.57b0, 0.58b0, 0.59b0)
ERROR: No matching distribution found for opentelemetry-exporter-prometheus

notatallshaw avatar Nov 15 '25 03:11 notatallshaw

Very nice - and very neeeded :)

potiuk avatar Nov 15 '25 12:11 potiuk