Skip to content

'pip index versions' never prints the (latest) marker #14177

Description

@2ykwang

Description

pip index versions has logic that prints INSTALLED: %s (latest) when the installed version is the newest, but a type mismatch in the comparison keeps that branch from ever being taken. So instead of the (latest) marker, a separate LATEST: line is printed.

code:

if dist.version == latest:
write_output("INSTALLED: %s (latest)", dist.version)
else:
write_output("INSTALLED: %s", dist.version)
if parse_version(latest).pre:
write_output(
"LATEST: %s (pre-release; install"
" with `pip install --pre`)",
latest,
)
else:
write_output("LATEST: %s", latest)

Note that fixing the comparison would remove the LATEST: line that is currently printed.

Expected behavior

$ pip index versions django
django (6.0.7)
Available versions: 6.0.7, 6.0.6, 6.0.5, ...
INSTALLED: 6.0.7 (latest)

pip version

26.1.2

Python version

3.14

OS

mac os

How to Reproduce

  • pip install django (6.0.7 is the latest release)
  • pip index versions django

Output

$ pip index versions django
django (6.0.7)
Available versions: 6.0.7, 6.0.6, 6.0.5, ...
INSTALLED: 6.0.7
LATEST:    6.0.7

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: indexThe 'pip index' commandtype: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions