## zc.buildout for builds and profit
Wes Mason
[@1stvamp](http://twitter.com/1stvamp)
[www.serverdensity.com](http://www.serverdensity.com/)
## What?
- [www.buildout.org](http://www.buildout.org/)
- Build tool (e.g. like make/cmake/rake)
- Started out as Zope/Plone build tool (but don't let that put you off)
## Config files
- INI / RFC 822 style
- `buildout.cfg`
[buildout]
develop = .
parts = python
test
eggs = coverage
Django
[versions]
Django = 1.2
coverage = 3.5.2
[python]
...
[test]
...
## Dependencies
- Install dependencies, version pinning etc.
- Sandboxing (like virtualenvs, *but no longer in 2.x*)
- `buildout` can be bootstrapped itself and sandboxed
$ python boostrap.py
$ bin/buildout
## Recipes
- Many "recipes" available from PyPi for Python projects with config/setup
- Build and install non-Python stuff along side your project
- Various tasks for making your project
[buildout]
parts = var-dir
var-directory = ${buildout:directory}/var
[var-dir]
recipe = z3c.recipe.mkdir
paths = ${buildout:var-directory}/celery
## bin scripts
- Wrap console scripts in sandboxed `bin/` dir
- `buildout` will do this automatically
- You can also create special wrappers yourself:
- `zc.recipe.egg`
- `z3c.recipe.scripts`
- Even interpreters
[python]
recipe = z3c.recipe.scripts:interpreter
eggs = ${buildout:eggs}
extra-paths = ${buildout:directory}/src/myapp/somemodule
script-initialization = os.environ['PROJ_ENV'] = "${config:environment}"
## Config files (again)
- Extendable configs
- Lets you create configs for specific setups
- `production.cfg`
[buildout]
find-links =
http://my-private-pypi.somecompany.com/
extends = buildout.cfg
[config]
environment = production
$ bin/buildout -c production.cfg
...
$ bin/python
Python 2.7.1
>>> import os
>>> os.environ['PROJ_ENV']
'production'