[Django]-Pypi see older versions of package

85👍

It’s perhaps a little inelegant, but it appears that you can go to the URL

https://pypi.python.org/simple/<package>

And you will get a bunch of links to tarballs for the package.

Ex:

https://pypi.python.org/simple/django-filebrowser-no-grappelli/

38👍

This is visible in the new UI for pypi:

https://pypi.org/project/<package>/#history

For example:

https://pypi.org/project/django-filebrowser-no-grappelli/#history

13👍

You can use this short Python 3 script to grab the list of available versions for a package from PyPI using JSON API:

#!/usr/bin/env python3

import sys    
import requests
from pkg_resources import parse_version    

def versions(pkg_name):
    url = f'https://pypi.python.org/pypi/{pkg_name}/json'
    releases = requests.get(url).json()['releases']
    return sorted(releases, key=parse_version, reverse=True)    

if __name__ == '__main__':
    print(*versions(sys.argv[1]), sep='\n')

Demo:

$ python versions.py django-filebrowser-no-grappelli
3.7.8
3.7.7
3.7.6
3.7.5
3.7.4
3.7.3
3.7.2
3.7.1
3.7.0
3.6.2
3.6.1
3.5.8
3.5.7
3.5.6
3.1.1

8👍

Using pip you can find out all the available versions of that package:

pip install django-filebrowser-no-grappelli==randomwords

This will produce an output of all the available packages:

Could not find a version that satisfies the requirement
  django-filebrowser-no-grappelli==randomwords
(from versions: 3.1.1, 3.5.6, 3.5.7, 3.5.8, 3.6.1, 3.6.2, 3.7.0, 3.7.1, 3.7.2)
   No matching distribution found for
   django-filebrowser-no-grappelli==randomwords

4👍

Store the following code in the get_version.py file:

import json
import sys
import urllib2

from distutils.version import LooseVersion

name = sys.argv[1]

resp = urllib2.urlopen("https://pypi.python.org/pypi/{}/json".format(name))
data = json.load(resp)

for ver in sorted([LooseVersion(version) for version in data["releases"].keys()]):
    print ver.vstring

Run it to get a sorted list of all package versions:

python get_version.py %PACKAGE-NAME%

3👍

If you are using pip to install your package, then you may use:

pip install yolk
yolk -V django-filebrowser-no-grappelli

Unfortunately the only available version seems to be:

django-filebrowser-no-grappelli 3.1.1

However, you can try to find another version on the Internet and install by:

pip install -Iv <url_package>

Leave a comment