title: Reinstall virtualenv with tox when requirements.txt or setup.py changes
body: <p>Previously I was manually using a Makefile that looked something like this:</p>
  
  <pre><code>.PHONY: all
  all: tests
  
  .PHONY: tests
  tests: py_env
      bash -c 'source py_env/bin/activate &amp;&amp; py.test tests'
  
  py_env: requirements_dev.txt setup.py
      rm -rf py_env
      virtualenv py_env
      bash -c 'source py_env/bin/activate &amp;&amp; pip install -r requirements_dev.txt'
  </code></pre>
  
  <p>This had the nice side-effect that if I changed requirements_dev.txt or setup.py, it would rebuild my virtualenv.  But feels a bit clunky.</p>
  
  <p>I'd like to use <code>tox</code> to do a similar thing.  I understand <code>tox</code> has a <code>--recreate</code> option, but I'd rather call that <em>only</em> when I need to.</p>
  
  <p>My new setup is something like this:</p>
  
  <pre><code># Makefile
  .PHONY: all
  all: tests
  
  .PHONY: tests
  tests:
      tox
  </code></pre>
  
  <p>and</p>
  
  <pre><code># tox.ini
  [tox]
  project = my_project
  envlist = py26,py27
  
  [testenv]
  install_command = pip install --use-wheel {opts} {packages}
  deps = -rrequirements_dev.txt
  commands =
      py.test {posargs:tests}
  </code></pre>
  
  <p>An ideal solution would use just things in <code>tox</code>, however an acceptable solution would involve the Makefile and the <code>--recreate</code> flag.</p>