craftbeerpi4-pione/testversion.py
2022-07-16 10:26:32 +02:00

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')