title: Distributing a python package along with module dependencies using RPM
body: <p>I've got several python applications consisting of scripts/modules that should be packaged and deployed as RPMs.</p>
  
  <p>The trickier bit is that each application should be distributed along with all python module dependencies, and these should be used in preference to any that are installed system wide.</p>
  
  <p>The target hosts for some of these RPMs have limited network access, so the RPMs should contain everything needed to run the app, rather than downloading anything at deploy time.</p>
  
  <p>I've looked at packaging and distributing a <a href="http://www.virtualenv.org/en/latest/" rel="noreferrer">virtualenv</a>, but relocating a virtualenv doesn't seem to be well supported.</p>
  
  <p>I've looked at <a href="http://www.buildout.org/en/latest/" rel="noreferrer">zc.buildout</a>, but found the documentation to be lacking. I could see how to download dependencies during development, but not how to distribute them as part of a larger application. It's possible different apps require different versions of the same module, so these shouldn't be installed system wide.</p>
  
  <p>Another pain point is that any python scripts in the app need to be modified to use a different sys.path during development and after deployment, I couldn't see an obvious way around this.</p>
  
  <p>Are suggestions on how best to achieve this? An ideal summary of the workflow from a developer's point of view would look like:</p>
  
  <ol>
  <li>download application source</li>
  <li>run script to fetch specific module dependencies if not present (perhaps using <a href="http://www.pip-installer.org/en/latest/" rel="noreferrer">pip</a>)</li>
  <li>run script to build python app, and package it and all downloaded dependencies into RPM</li>
  </ol>
  
  <p>The final RPM should then be installable and runnable on a host with no network access, and only a python interpreter installed.</p>