Installing Plone 5 using pip

Door Roel Bruggink | Op 05-04-2016
You do not need buildout to install Plone. Here's how.

A couple of years back we moved forward by converting Zope and Plone packages into eggs. This made us more on-par with the Python community. We also started using zc.buildout for managing our environment. One of the biggest wins of buildout was version pinning without installing eggs. This allows for a community wide effort to define a set of versions of packages that are known to works with an application (a Known Good Set). In the Plone world we use multiple KGSs. For example, the Plone 5 KGS extends the Zope2 KGS (which extends the ZTK KGS). The Plone KGS also overrides specific -or 'pins'- versions, ie 'Products.ZCatalog = 3.0.2' vs 'Products.ZCatalog = 2.13.17'.

The Python community nowadays mostly uses pip + a container (virtualenv, docker, etc) over buildout. Luckily pip now support constraint files. Constraint files specify version pins, but do not declare a concrete dependency. This also works for Plone, but we will have to create a constraints file (they do not yet exist for Plone and Zope). Install zc.buildout in a container and run the script.

virtualenv-2.7 .
./bin/pip install -U setuptools pip zc.buildout
curl https://gist.githubusercontent.com/jaroel/d7f57b0884ab1eb3007cdd787fd388a2/raw/63d16672c0f701352a161b6e701372211f0ee502/make_constraintstxt.py -o make_constraints.py
./bin/python make_constraints.py > constraints.txt
./bin/pip install Plone -c constraints.txt

Next you should see something like this in your console:

❯ ./bin/pip install Plone -c constraints.txt
Collecting Plone==5.0.3 (from -c constraints.txt (line 343))
Using cached Plone-5.0.3.zip
Collecting plone.app.openid==2.1.0 (from -c constraints.txt (line 354))
Using cached plone.app.openid-2.1.0.zip
Collecting Zope2==2.13.24 (from -c constraints.txt (line 359))
Using cached Zope2-2.13.24.tar.gz
Collecting zope.site==3.9.2 (from -c constraints.txt (line 361))
Using cached zope.site-3.9.2.tar.gz
Collecting zope.deferredimport==3.5.3 (from -c constraints.txt (line 362))
Using cached zope.deferredimport-3.5.3.tar.gz
Collecting DocumentTemplate==2.13.2 (from -c constraints.txt (line 369))
Using cached DocumentTemplate-2.13.2.zip
Collecting Products.ExternalMethod==2.13.1 (from -c constraints.txt (line 372))
Using cached Products.ExternalMethod-2.13.1.zip
Collecting Products.CMFPlone==5.0.3.1 (from -c constraints.txt (line 375))
Downloading Products.CMFPlone-5.0.3.1.tar.gz (18.1MB)
100% |████████████████████████████████| 18.1MB 41kB/s

 

We can almost run our new Plone instance, but we need to create a few files. Normally I would create these using something like Cookiecutter, but for now this will have to do.
We have to create a Zope instance by hand:

./bin/mkzopeinstance --python=bin/python --user=admin:admin -d instance0

(un)Fortunately we cannot use z3c.auctoinclude, as it tries to read from the sys.path entries to load package. So we'll need minimal custom site.zcml to make my Plone 5 instance run without z3c.autoinclude.

curl https://gist.githubusercontent.com/jaroel/69607863bbc9125df3aed0184c936ef2/raw/56ae4b8d35ec890ffe262e58105cc1784f8dc594/site.zcml -o ./instance0/etc/site.zcml

Next we can start our Plone instance by disabling z3c.autoinclude: 

Z3C_AUTOINCLUDE_DEPENDENCIES_DISABLED=1 Z3C_AUTOINCLUDE_PLUGINS_DISABLED=1 ./instance0/bin/zopectl fg

And finally we'll open our browser and point to http://localhost:8080/:

Create Plone site on pip Edit the Plone front-page in pip