Skip to content

Instantly share code, notes, and snippets.

@ScottJWalter
Forked from joshkehn/fabfile.py
Last active January 22, 2024 10:50
Show Gist options
  • Select an option

  • Save ScottJWalter/438557f840144fad487347c8d3abe0d2 to your computer and use it in GitHub Desktop.

Select an option

Save ScottJWalter/438557f840144fad487347c8d3abe0d2 to your computer and use it in GitHub Desktop.
Fabric api to upgrade or freeze pip packages
from fabric.api import local
import pip
def freeze ():
local("pip freeze > requirements.txt")
local("git add requirements.txt")
local("git commit -v")
def upgrade ():
for dist in pip.get_installed_distributions():
local("pip install --upgrade {0}".format(dist.project_name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment