mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-12-22 13:34:55 +01:00
13 lines
411 B
Python
13 lines
411 B
Python
|
import json
|
||
|
import sys
|
||
|
from urllib import request
|
||
|
from pkg_resources import parse_version
|
||
|
|
||
|
def versions(pkg_name):
|
||
|
url = f'https://pypi.python.org/pypi/{pkg_name}/json'
|
||
|
releases = json.loads(request.urlopen(url).read())['releases']
|
||
|
releases = sorted(releases, key=parse_version, reverse=True)
|
||
|
return [releases[0]]
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
print(*versions(sys.argv[1]), sep='\n')
|