Skip to content

uv seems to incorrectly match local versions on triple-equals #14981

@geofft

Description

@geofft

Summary

From https://packaging.python.org/en/latest/specifications/version-specifiers/#arbitrary-equality :

Arbitrary equality comparisons are simple string equality operations which do not take into account any of the semantic information such as zero padding or local versions. [...]
This operator may also be used to explicitly require an unpatched version of a project such as ===1.0 which would not match for a version 1.0+downstream1.

However, the following test case produces a package and environment with a dependency on dependency===1.0 that is locked to 1.0+downstream1:

#!/bin/bash

set -eux

uv init --lib dependency
cd dependency
uv version 1.0
uv build
uv version 1.0+downstream1
uv build
cd ..
uv init consumer
cd consumer
uv add ../dependency/dist/dependency-1.0-py3-none-any.whl
uv add ../dependency/dist/dependency-1.0+downstream1-py3-none-any.whl
uv add dependency===1.0
cat pyproject.toml
cat uv.lock

I think the code appears to handle the ExactEqual case right, so I'm not totally sure what's wrong. Linking #8797 which implemented local version handling.

Platform

Ubuntu 24.04, x86_64

Version

uv 0.8.4

Python version

3.13.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions