I would like to highlight one (two) use case where using arbitrary equality works (with pip and sort of with uv, with a caveat) and is necessary right now - handling build suffixes and sub-patch (internal patched) versions.
Example:
Index contains files:
- torch-1.2.3.tar.gz (using tar.gz for example simplicity)
- torch-1.2.3+cpu.tar.gz
- torch-1.2.4.0+cpu.tar.gz
- torch-1.2.4.0+cu128.tar.gz
Running “uv pip compile <(echo ‘torch==1.2.3’)” results in “torch-1.2.3+cpu” picked up. The only way to resolve “torch-1.2.3.tar.gz” is to use “pip install torch===1.2.3” or “uv pip compile <(echo ‘torch===1.2.3’) . This works.
The other case is - if user tries to install a package which is not in the index, but they need that exact package version. Trying to resolve “torch==1.2.4” results in torch-1.2.4.0+cu128.tar.gz. Here also === helps. However I found that behavior deviates between pip and uv - uv will pick up .0 version as long as suffix matches, even if === is used. Pip will not.
Some examples from real life:
(venv) [ /tmp/tmp34u1frv7/venv ]$ pip download torch==2.9.1 --no-deps
Looking in indexes: <redacted>
Collecting torch==2.9.1
Downloading <redacted>/torch-2.9.1.0%2Bcu128-cp312-cp312-linux_x86_64.whl.metadata (29 kB)
Downloading <redacted>/torch-2.9.1.0%2Bcu128-cp312-cp312-linux_x86_64.whl (614.2 MB)
━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 201.3/614.2 MB 106.8 MB/s eta 0:00:04
# Ctrl+C
ERROR: Operation cancelled by user
(venv) [ /tmp/tmp34u1frv7/venv ]$ pip download torch===2.9.1 --no-deps
Looking in indexes: <redacted>
ERROR: Could not find a version that satisfies the requirement torch===2.9.1 (from versions: 2.9.1.0+cpu, 2.9.1.0+cu128)
ERROR: No matching distribution found for torch===2.9.1
(venv) [ /tmp/tmp34u1frv7/venv ]$ pip download torch===2.9.1+cpu --no-deps
Looking in indexes: <redacted>
ERROR: Could not find a version that satisfies the requirement torch===2.9.1+cpu (from versions: 2.9.1.0+cpu, 2.9.1.0+cu128)
ERROR: No matching distribution found for torch===2.9.1+cpu
(venv) [ /tmp/tmp34u1frv7/venv ]$ pip download torch==2.9.1+cpu --no-deps
Looking in indexes: <redacted>
Collecting torch==2.9.1+cpu
Downloading <redacted>/torch-2.9.1.0%2Bcpu-cp312-cp312-linux_x86_64.whl.metadata (29 kB)
Downloading <redacted>/torch-2.9.1.0%2Bcpu-cp312-cp312-linux_x86_64.whl (151.9 MB)
━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━ 73.7/151.9 MB 100.2 MB/s eta 0:00:01
# Ctrl+C
ERROR: Operation cancelled by user
(venv) [ /tmp/tmp34u1frv7/venv ]$ uv pip compile <(echo "torch==2.9.1")
Resolved 10 packages in 716ms
# ...
torch==2.9.1.0+cu128
# ...
(venv) [ /tmp/tmp34u1frv7/venv ]$ uv pip compile <(echo "torch===2.9.1")
× No solution found when resolving dependencies:
╰─▶ Because there is no version of torch==2.9.1 and you require torch==2.9.1, we can conclude that your requirements are unsatisfiable.
(venv) [ /tmp/tmp34u1frv7/venv ]$ uv pip compile <(echo "torch==2.9.1+cpu")
Resolved 10 packages in 456ms
# ...
torch==2.9.1.0+cpu
# ...
# DEVIATION BETWEEN PIP AND UV:
(venv) [ /tmp/tmp34u1frv7/venv ]$ uv pip compile <(echo "torch===2.9.1+cpu")
Resolved 10 packages in 411ms
# ...
torch==2.9.1.0+cpu
# ...