[Grok-dev] HEADS UP: Eggs!

Philipp von Weitershausen philipp at weitershausen.de
Thu Jul 12 13:01:30 EDT 2007

At EuroPython we've finally made Grok use the Zope3 eggs.  There are
several implications for both developers *of* Grok and people who
develop *with* Grok.

Shared eggs location

The most important change is obviously that Zope 3 will now be
downloaded as eggs. LOTS of eggs. If you have multiple Grok projects,
it will make a lot of sense to have a shared egg directory so that you
won't have to download all those packages each time.  To configure
buildout to store all eggs in a common directory, create a
~/.buildout/default file with the following contents::

   eggs-directory = /Users/philipp/shared-eggs

I am planning to add a switch to grokproject will allow you to specify
a shared eggs directory without having to create such a file.

The Grok trunk checkout

Developers who check out the Grok trunk simply can run bin/buildout
like before (except that now, it will download Zope 3 eggs). To start
up Zope, use the following command::

   $ bin/instance fg

(You no longer have to reach into parts/instance/bin.)

Using grokproject for a new project

If you want to create new Grok projects from now on, it is essential
that you use the newest version (0.4) of grokproject.  You may upgrade
your installed grokproject with::

   $ easy_install -U grokproject

The new version of grokproject should also be more robust because it
doesn't spawn any processes anymore. In particular, it might work on
Windows now (haven't tested that yet, reports would be welcome).

Migrating existing projects

Existing projects require a few adjustments to buildout.cfg. First of
all, you can remove everything in the [zope3] section except for a dummy
entry that is currently still needed::

   location =

The [data] and [tests] sections can stay as they are.  The [instance]
section should now read::

   recipe = zc.zope3recipes:instance
   application = app
   zope.conf = ${data:zconfig}

Then you will have to add an [app] section with the following

   recipe = zc.zope3recipes:app
   eggs = PROJECT
   site.zcml = <include package="grok" />
               <include package="PACKAGE" />
               <include package="zope.app.twisted" />

               <unauthenticatedPrincipal id="zope.anybody"
                                         title="Unauthenticated User" />
               <unauthenticatedGroup id="zope.Anybody"
                                     title="Unauthenticated Users" />
               <authenticatedGroup id="zope.Authenticated"
                                   title="Authenticated Users" />
               <everybodyGroup id="zope.Everybody"
                               title="All Users" />
               <principal id="zope.manager"
                          password_manager="Plain Text"

               <!-- Replace the following directive if you don't want
                    public access -->
               <grant permission="zope.View"
                      principal="zope.Anybody" />
               <grant permission="zope.app.dublincore.view"
                      principal="zope.Anybody" />

               <role id="zope.Manager" title="Site Manager" />
               <role id="zope.Member" title="Site Member" />
               <grantAll role="zope.Manager" />
               <grant role="zope.Manager"
                      principal="zope.manager" />

Be sure to replace PROJECT with the project's name (usually the
directory name), PACKAGE with the Python package name (usually the
project name as lower case) and USER and PASSWORD with whatever you

After running the buildout, you should be able to start Zope now with
the following command::

   $ bin/instance fg

(You no longer have to reach into parts/instance/bin.)

If something goes wrong, you can always take a look at the Grokstar
example application or at the output of grokproject 0.4 for

http://worldcookery.com -- Professional Zope documentation and training

More information about the Grok-dev mailing list