Home » Django » pypi see older versions of package

pypi see older versions of package

Posted by: admin November 30, 2017 Leave a comment

Questions:

This is the package I’m interested in :

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

However the latest version no longer supports Django 1.3. I need to find a version that does.
How do I see list of older versions ?

Answers:

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/

Questions:
Answers:

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

Questions:
Answers:

You can use this short Python3 snippet to grab the list of available versions for a package from PyPI:

>>> import requests
>>> from pkg_resources import parse_version
>>> 
>>> def versions(name):
...     url = "https://pypi.python.org/pypi/{}/json".format(name)
...     return sorted(requests.get(url).json()["releases"], key=parse_version)
... 
>>> print(*reversed(versions("Django")), sep="\n")
1.10.3
1.10.2
1.10.1
1.10
1.10rc1
1.10b1
1.10a1
...

Questions:
Answers:

Store the following code in 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 to get a sorted list of all package versions:

python get_version.py %PACKAGE-NAME%

Questions:
Answers:

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>

Questions:
Answers:

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