Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark pip index versions as no longer experimental #13188

Open
1 task done
krishanbhasin-px opened this issue Jan 28, 2025 · 3 comments
Open
1 task done

Mark pip index versions as no longer experimental #13188

krishanbhasin-px opened this issue Jan 28, 2025 · 3 comments
Labels
S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature

Comments

@krishanbhasin-px
Copy link

krishanbhasin-px commented Jan 28, 2025

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

@krishanbhasin-px krishanbhasin-px added S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature labels Jan 28, 2025
@pfmoore
Copy link
Member

pfmoore commented Jan 28, 2025

I'm happy to bring this PR!

Seems reasonable to me - thanks for the offer!

@leimao
Copy link

leimao commented Feb 1, 2025

Should this issue be closed given the key MR has been merged?

@leimao
Copy link

leimao commented Feb 1, 2025

Oh, my apology. The MR was closed instead of merged. This issue remains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

4 participants
@pfmoore @leimao @krishanbhasin-px and others