Skip to content
Software capabilities
PyPI

Find available versions of a Python package on PyPI

Use pip index versions to see versions pip considers for your environment. Use the PyPI Index API to inspect release files and their individual compatibility metadata.

Documentation reviewed · 2 methods with sources

Ways to do it

  1. CLI: python -m pip index versions <package>
  2. API: GET /simple/{project}/
CLI

python -m pip index versions <package>

Print versions on the configured package index for the current or specified Python environment.

Read source: pip index command reference
Requirements
Python with pip, the package name, and access to an index serving that package.
Limitations
Pip only reports stable versions by default. Add --pre when you want to consider prereleases.

Example shell

python -m pip index versions packaging --index-url https://pypi.org/simple
API

GET /simple/{project}/

Request the JSON representation to inspect available distribution files, their hashes, and any reported Python version requirements or yanked flag.

Read source: PyPI Index API
Requirements
A project name. Set Accept to application/vnd.pypi.simple.v1+json for a structured response.
Limitations
The index lists files. It leaves compatibility and release selection to your client.

Example shell

curl --fail -H 'Accept: application/vnd.pypi.simple.v1+json' https://pypi.org/simple/packaging/