0

For the last week I have been struggling to get pure isolation using buildout. What I'm looking to do is install Django and the other eggs that my project needs in isolation of any of the system-installed

I understand this question has been asked before here and here, but the answer to those questions do not work for me.

My question: How can I configure zc.buildout provide pure package isolation for a Django-based project?

Notes:

  • Although mentioned in various places, this is absolutely NOT the default for zc.buildout (as of version zc.buildout 1.6.x)
  • There are no buildout options that allow you to do this.
  • There are z3c.recipe.scripts options that allows you to do this for the python interpreter, but djangorecipe does not use z3c.recipe.scripts, and so ./bin/django shell has access to all the system packages.
Community
  • 1
  • 1
Jashugan
  • 517
  • 4
  • 13

1 Answers1

2

Use virtualenv to achieve isolation:

pip install virtualenv
virtualenv django_buildout
cd django_buildout
bin/pip install zc.buildout
bin/buildout init

zc.buildout let's you re-use existing eggs on purpose, it's aim is to satisfy the requirements set by the buildout. You should really pin all your versions down, and not let buildout pick them for you:

[buildout]
versions = versions
allow-picked-versions = false

[versions]
zc.buildout = 1.6.3
# etc.
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • That's very slick. Everything is nice and isolated for the initial build, but how would my team members recreate this build? They wouldn't get the same isolation I have. – Jashugan Jan 05 '13 at 06:33
  • @Jashugan: That's where the exact version pins come in; but you also already do need a minimum set of setup instructions. Next to 'use Python 2.7', you add 'use a virtualenv'. You need a set of instructions to get the buildout set up in the first place, not that hard to add that one requirement. – Martijn Pieters Jan 05 '13 at 09:46
  • So, they would check out the code (i.e. `hg clone django_buildout`), before following the steps above? – Jashugan Jan 06 '13 at 07:25
  • No, they'd check out the buildout afterwards. Note that in my projects we usually *don't* because we use version pins and thus achieve reproducibility because the team is guaranteed to end up with the correct versions wether or not they came from site-packages or from an egg cache or have been downloaded just for the project. – Martijn Pieters Jan 06 '13 at 10:41