Mass-update pip pkgs - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: General (https://python-forum.io/forum-1.html) +--- Forum: Code sharing (https://python-forum.io/forum-5.html) +--- Thread: Mass-update pip pkgs (/thread-19810.html) |
Mass-update pip pkgs - mcmxl22 - Jul-15-2019 Here is a program I wrote to mass-update pip packages. It relies on pip-review and another module I wrote to make numbered lists. import numli import os def pkg_update(): """Update pip packages.""" options = ['Yes', 'Exit'] numli.addnum(options) check = input('Check for updates? ') if check in '1': print('Checking for updates.') os.system('pip list -o') os.system('pip-review --local --interactive') pkg_update() elif check in '2': raise SystemExit else: pkg_update() if __name__ == "__main__": pkg_update()Here is the list numbering module. I got tired of typing out the for loop every time. def addnum(num): """Add numbers to a list""" for c, value in enumerate(num, 1): print(c, value) if __name__ == "__main__": addnum(num) |