Blog

Automated (No Prompt) Deployment with Pip

Posted by Peter Baumgartner on July 1, 2010. Filed under pro tip

We love pip and Fabric for Django deployment. You can see our boilerplate fabfile.py here. Pip, however, isn’t safe to run in an automated fashion. If you attempt to switch branches or repos for one of your editable requirements, you’ll be presented with this input:

What to do? (s)witch, (i)gnore, (w)ipe, (b)ackup

At this time, there is an open bug to solve this problem, but thanks to the trusty *nix toolkit, we have an easy workaround. Enter yes. From its manpage:

NAME
       yes - output a string repeatedly until killed

SYNOPSIS
       yes [STRING]...
       yes OPTION

DESCRIPTION
       Repeatedly output a line with all specified STRING(s), or `y'.
...

I have the most success with the “wipe” option for pip, so now we can simply run:

yes w | pip install -r requirements.pip

This answers w to any prompt that pip displays, making it much more robust to use in an automated environment.

Need to get everyone on the same page? Try Ginger! Hold productive discussions with your teammates across the globe or across the hall. Build consensus, hash out complex ideas, and eliminate meetings altogether.

Looking for help building your web app? Lincoln Loop is a full service web studio focusing on Django development. See what we can do.

blog comments powered by Disqus