Primary image for Automated (No Prompt) Deployment with Pip

Automated (No Prompt) Deployment with Pip

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 <span class="caps">OPTION</span>

DESCRIPTION
       Repeatedly output a line with all specified <acronym title="s"><span class="caps">STRING</span></acronym>, or `y&#8217;.
&#8230;</code></pre></figure>


I have the most success with the &#8220;wipe&#8221; 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.
Peter Baumgartner

About the author

Peter Baumgartner

Peter is the founder of Lincoln Loop, having built it up from a small freelance operation in 2007 to what it is today. He is constantly learning and is well-versed in many technical disciplines including devops, …

View Peter's profile