mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-08 08:27:43 +01:00
13 lines
No EOL
411 B
Python
13 lines
No EOL
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') |