Gawel's blurb

Twitter updates

  • need a beer after a great skate session but fridge is empty. #WTF #fb

Feeds

Tags

Comments

Archives

Blogroll

Combine zc.buildout and pip benefits

I've just released a new zc.buildout recipe which allow to install packages with pip.

I am getting really excited about it because it has many advantages taken from both components.

  1. The recipe adds a virtualenv in the parts/ directory of your buildout then use this binary to generate executable python scripts. So you have a clean sandbox.
  2. The recipe is based on zc.recipe.egg#scripts so you can share your eggs between buildouts as usual.
  3. Of course, you can install some .pybundle files.
  4. You can build package from svn with the editables option.
  1. Each line found in the install option is the last part of a pip command. This allow you to build eggs with dependencies. For example to install lxml in a pure sandbox without libxml2 and libxslt installed you need Cython installed and this command line python setup.py install --static-deps to install lxml. This is easy with the recipe. Here is a sample configuration file for this case:
[buildout]
# the cache dir is used by buildout & pip
download-cache = download
parts = eggs

[eggs]
recipe = gp.recipe.pip

# eggs installed by pip (also add the Deliverance bundle)
install =
    Cython
    --install-option=--static-deps lxml==2.2alpha1
    http://deliverance.openplans.org/dist/Deliverance-snapshot-latest.pybundle

# eggs installed by zc.recipe.egg
eggs =
    Paste
    pyquery

That's all !! This works perfectly on my Mac OSX and should works on most system.

In fact zc.recipe.egg will work in most cases but when you need a clean sandbox and some extra options, gp.recipe.pip is a good alternative.

Marco 27/07/2009 21:57

Hi I would use a django app inside a django recipe the app is hosted on bitbucket this is my buildout.cfg

[buildout] parts = django

System Message: ERROR/3 (<string>, line 8)

Unexpected indentation.
contact-form

[contact-form] recipe=gp.recipe.pip editables = hg+http://bitbucket.org/ubernostrum/django-contact-form/@tip#egg=contact-form

[django] recipe = djangorecipe version = 1.0.2 extra-paths = ${buildout:directory}/project

System Message: ERROR/3 (<string>, line 19)

Unexpected indentation.
${contact-form}/contact_form

wsgi = True eggs = django-autoslug

but I dunno how to get it works $(contact-form} or $(contact-form:location} or $(contact-form:source} or $(contact-form:directory} or $(contact-form:src} ecc... doesn't work do you have some advice ? cheers

Marco 27/07/2009 22:01

I missed a few things: django-autoslug is on pypi so it works the app that I want to use is django-contact-form

pydev is a parts in a config that I didn't paste the error from buildout is Error: Referenced option does not exist: contact-form directory (or any other variable I try to load

Jean-mat Grimaldi 28/07/2009 10:26

Merci.

Dommage que je n'ai pas vu ça avant (install lxml sous RedHat), ça m'aurait rendu service.

Donc ça mérite un peu de buzz ton truc.

gawel 29/07/2009 11:23

@marco if you dont need some C extensions you'd better use gp.vcsdevelop

Marco 30/07/2009 00:42

I tried but I don't understand how to use it the most difficult part for me is: when I create a part how can I include them in the pythonpath of another (for instance inside djangorecipe) regards

gawel 31/07/2009 14:56

@Marco with gp.vcsdevelop you just need to use the vcs-extends-develop to checkout the source then add your packages names in the egg option. That's all