Skip to content

Mark pip index versions as no longer experimental #13188

@krishanbhasin-px

Description

@krishanbhasin-px

What's the problem this feature will solve?

Since the pip install pip== "hack" stopped working, I do not believe there is a "stable" pip-centric way to list all the versions of a package. It is possible to query the HTTP API, but this may not be desirable for all users.

I myself have been asking colleagues to use the command when helping them debug the versions they have available to them and in their environments. I have found it stable and easy to use, and would love to be able to use it more widely without worry that it could be unexpectedly removed.

pip index versions was introduced over 4 years ago in #8978, and viewing the commit history, it does not appear to have changed very much since then.

In relevant issues such as #12852, it was mentioned that a PR to remove the experimental status may well be considered and possibly merged, so I am proposing it here.

Describe the solution you'd like

  1. remove the warning about pip index versions being experimental
  2. add documentation on the command
  3. add a --json flag

The code for the --json flag could be something like:

            if options.json:
                env = get_default_environment()
                dist = env.get_distribution(query)
                structured_output = {
                        "name": query,
                        "versions": formatted_versions,
                        "latest": latest,
                    }

                if dist is not None:
                    structured_output["installed_version"] = dist.version

                write_output(structured_output)
                return

resulting in an output like:

{
    "name": "package-name",
    "versions": ["1.0.0", "1.0.1", ...],
    "latest": "2.0.0",
    "installed_version": "1.0.0"  // if installed
}

Alternative Solutions

Not making any change to pip

Additional context

This would be an entirely backwards-compatible change.

I'm happy to bring this PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions