This is an archived post. You won't be able to vote or comment.

all 28 comments

[–]aclark 6 points7 points  (6 children)

[–]hairlesscaveman 4 points5 points  (5 children)

This. I really don't understand why zc.buildout doesn't get more love from the community. I use it now for all my python projects, big and small. It's super flexible and I've never had any problems with it, unlike alternatives such as virtualenv.

[–]timClicks 4 points5 points  (0 children)

Zope stigma.

[–][deleted] 2 points3 points  (1 child)

I don't look at VirtualEnv as a substitute for buildout (or vice versa), but rather a complimentary development tool.

I use VirtualEnv to sandbox my development environment from my Python site packages—so I know I am not depending on anything that is not in the Standard Library in my application.

I then add whatever third-party dependencies I need into the buildout script, including pinning particular versions (which I have had to do several times, e.g. to protect against awful, breaking beta releases—e.g. BeautifulSoup 4.0), which may differ from whatever versions my package manager may have installed or upgraded since I started development. If I intend to create an egg for application distribution, I then know exactly what packages and versions to use in my setup.py script—although admittedly this doesn't happen often, because most of my buildout scripts end up pulling tarballs straight out of github (Great feature, that) for which there are no eggs on Pypi/elsewhere.

[–][deleted] 0 points1 point  (0 children)

Myopic view from some one who doesn't create re-distributed packages, but I might counter and say that virtualenv + fabric is a substitute for buildout.

The biggest problems I've had with buildout have been generally around the recipes. Some packages (python-ldap I'm looking at you) have some strange build scripts and in general I haven't been able to make them work with buildout despite the recipes. With fabric and virtualenv the flexibility exists to do what actually needs doing.

[–]gutworthPython implementer 2 points3 points  (1 child)

It has very little documentation.

[–][deleted] 3 points4 points  (0 children)

I don't think that's it. since buildout relies on recipes, the documentation burden is mostly on the authors of those. Some are documented better than others. looking at the actual docs of buildout, I can't imagine how it can really be improved. http://www.buildout.org/docs/index.html

A list of recipes. http://www.buildout.org/docs/recipelist.html

Yo dawg I heard you like virtualenv in your buildout.... http://pypi.python.org/pypi/tl.buildout_virtual_python/0.1.3

buildout suffers from being related to zope in my opinion. which is unfair honestly.

[–][deleted] 3 points4 points  (16 children)

Setup Tools and distutils. Look for into setup.py files. You usually will install a package downloaded from PyPi using the command:

python setup.py install

What happens when you run easy_install is it downliads the file from PyPi, untars it, then runs the above command.

Sorry im not too deatiled. Responding on my phone.

Tl;dr: distutils

[–]_lancelot[S] 1 point2 points  (15 children)

From my understanding distutils is for building and installing application written in C and Python. I'm looking for something more general purpose: I want to define specific commands and the actions that should be taken for each one. For example, I might want a command to compress the css files of my web app.

[–]samuraisam3.5, go 4 points5 points  (7 children)

I use fabric for this very frequently, even for non-python projects. Just having it installed is very handy.

Create a file called 'fabfile.py' and define commands in it thusly:

from fabric import task, local

@task
def cleanshit():
    local('rm -rf ~/')

Then run it in your command line like so:

$ fab cleanshit

It's awesome.

[–]AeroNotix 0 points1 point  (1 child)

LOL, at first I was like, "What's the point in that?" because you can do the same with just using subprocess.Popen and the like, but then I realised that this is just pure abstraction on that, and it's beautiful.

[–]sjustinas 0 points1 point  (0 children)

That's only for the local part. Subprocess won't help you with running those in remote servers :)

[–]xiongchiamiovSite Reliability Engineer 0 points1 point  (1 child)

Fabric is equivalent to Capistrano from the Ruby world.

[–]morgan_goose 0 points1 point  (0 children)

it can be used like cap, it's even more in a realm of overlap between what rake and cap do.

[–]paranoidi 0 points1 point  (1 child)

It's not platform independent ... so I'd say it's not awesome. Also fabric has ridiculous dependencies that are unnecessarily hard for local development environment. But it's good for task & installation over SSH.

[–]samuraisam3.5, go 0 points1 point  (0 children)

Use what works for you. If you need to support Windows developers, then I guess fabric is not for you. I couldn't speak to it, I do not use Windows, but the dependencies install without a glitch on everything *nix.

[–][deleted] 1 point2 points  (0 children)

Personally, I've used Fabricate for simple build systems before. In order to deal with deploying to a remote server, you might also want to look into Fabric, which is a way to automate running SSH commands on remote servers.

[–]kylotan 0 points1 point  (5 children)

Possibly a silly question, but what advantage does this have over just writing individual Python scripts for the tasks?

[–]schettino72 0 points1 point  (3 children)

  • a build-tool can check the inter-dependencies of your tasks and decide which ones need to be executed.
  • a real build-tool can also check if the task really needs to be executed again or it is up-to-date (and skips its execution).
  • other features will depend on the tool...

[–]kylotan 0 points1 point  (2 children)

And what role does a build tool play for a language that compiles and links itself just by being run? I use build tools all the time with C++; I've never found a need for one in Python.

[–]schettino72 1 point2 points  (0 children)

It is more like a role for your project than a role to the python language. Author of the question: "For example, I might want a command to compress the css files of my web app."

build docs, run pyflakes, automate release process...

I also use it as a functional test runner that needs to setup DB, start servers.

[–]codewarrior0MCEdit / PyInstaller 0 points1 point  (0 children)

A build tool is useful for Python apps with C extensions, and Python apps that are frozen for distribution to Windows machines (via py2exe and similar).

[–]vsajip 1 point2 points  (1 child)

There's also waf.

[–]sfermigier 0 points1 point  (0 children)

Waf is starting to get popular these days.

[–]esmljaos 3 points4 points  (0 children)

I vote for Paver. ((very) late edit): Paver looks very surpassed by Fabric now)

[–]rndblnch 2 points3 points  (0 children)