Search code examples
pythonvirtualenvbuildout

How to migrate from virtualenv to buildout?


I'm attempting to move a project from virtualenv to buildout, but I don't think I've grasped the whole concept of buildout. All the tutorials I've found discuss buildout in the context of using it with Zope, which I'm not using and therefore can't see how to continue.

My file structure with virtualenv is as follows:

myapp/
  app.py

Which is run using /path/to/venvs/myapp/bin/python /path/to/myapp/script.py.

With buildout, my file structure is:

myapp/
  app.py
  bootstrap.py
  buildout.cfg

Running python bootstrap.py and bin/buildout gives me these additional files:

myapp/
  bin/
    buildout
  eggs/
    setuptools-0.6c12dev_r80622-py2.6.egg
    tornado-1.0.1-py2.6.egg
  parts/

At this point I'm unsure how to "run" my app.

Advice?


Solution

  • The following recipe will, install tornado as an egg and create a python and myapp script in the bin directory with the correct search path to find the tornado egg.

    [buildout] 
    parts = python 
    eggs = tornado 
    extra-paths = ${buildout:directory}
    
    [python] 
    recipe = zc.recipe.egg 
    interpreter = python 
    eggs = ${buildout:eggs} 
    entry-points = myapp=app:main 
    extra-paths = ${buildout:extra-paths}