Created
March 26, 2018 14:07
-
-
Save dwickwire/863cbbc42f09b3e7e8886b3df9a91e81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import requests | |
for file in os.listdir('.'): | |
if not file.endswith('.txt'): | |
continue | |
with open(file, 'r') as f: | |
base = f.readlines() | |
for req in base: | |
if '==' not in req: | |
continue | |
package, version = req.strip().split('==') | |
url = "https://pypi.python.org/pypi/%s/json" % package | |
data = requests.get(url).json() | |
releases = [r for r in data['releases'].keys() | |
if 'a' not in r and | |
'b' not in r and | |
'rc' not in r] | |
latest = sorted(releases, reverse=True)[0] | |
if version < latest: | |
print(f'Please upgrade {package} to {latest}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment