Skip to main content
  1. Posts/

Getting a list of the older versions of a PyPI Package

·1 min

As of right now, there’s no link on PyPI to list older versions of a package. I was looking for an older version of oauth2client package on PyPI, but could not find any link on the package’s PyPI page.

It turns out there is a JSON API which lists any package’s metadata. As an example, this URL lists all the old versions of oauth2client.

I used the jq tool to list out any package’s versions.

curl -s "$1/json" | jq '.releases | to_entries[] | .key '

And as a shell function

function lspip {
  if [[ -z "$1" ]]; then
    echo usage :$0 package
    return 1
  curl -s "$1/json" | jq '.releases | to_entries[] | .key '

This is useful when you want to quickly list out all the versions of any PyPI package.