Python Forum
Mass-update pip pkgs
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mass-update pip pkgs
#1
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)
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020