File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1212import traceback
1313import time
1414import tempfile
15+ import requests
16+ import packaging .version
1517
1618import attr
1719import lib50
@@ -362,6 +364,18 @@ def main():
362364
363365 args = parser .parse_args ()
364366
367+ # Check for newer version
368+ if __version__ :
369+ try :
370+ latest = max (requests .get ("https://pypi.org/pypi/compare50/json" , timeout = 30 ).json ()["requests" ], key = packaging .version .parse )
371+ if latest > __version__ :
372+ termcolor .cprint (
373+ "A newer version of compare50 is available. Run pip3 install --upgrade compare50 to upgrade." , "magenta" )
374+ except requests .ConnectionError : # don't error if running offline
375+ pass
376+ except Exception as e :
377+ termcolor .cprint (f"Version check failed: { e } " , "red" )
378+
365379 excepthook .verbose = args .verbose
366380
367381 # Set max file size in bytes
Original file line number Diff line number Diff line change 2222 packages = find_packages (exclude = ["tests" ]),
2323 scripts = ["bin/compare50" ],
2424 url = "https://github.com/cs50/compare50" ,
25- version = "1.2.8 " ,
25+ version = "1.2.9 " ,
2626 include_package_data = True ,
2727)
You can’t perform that action at this time.
0 commit comments