Skip to content

Instantly share code, notes, and snippets.

@dwickwire
Created March 26, 2018 14:07
Show Gist options
  • Save dwickwire/863cbbc42f09b3e7e8886b3df9a91e81 to your computer and use it in GitHub Desktop.
Save dwickwire/863cbbc42f09b3e7e8886b3df9a91e81 to your computer and use it in GitHub Desktop.
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