Daniel Nouri's Old Blog

Note that this blog is discontinued. You can find my new blog here: Daniel Nouri's Blog.

Fri, 16 Feb 2007

ploneenv recipes

I've updated the experimental Plone 3.0 setuptools distribution and ploneenv today a bit and fixed some bugs along the way.

Here are some small recipes that show you how ploneenv works, and how you can make use of it.

A requirement for all of these recipes is that you have ploneenv installed, which you can install like this:

sudo easy_install ploneenv

The recipes will also assume that you have two shell variables set. One is MKZO, the path to the mkzopeinstance.py script of your Zope 2.10 installation. The other is INSTANCE_HOME, the folder where you want your Zope instance to go into. This is an example of setting those variables:

MKZO=~/lib/Zope-2.10/bin/mkzopeinstance.py
INSTANCE_HOME=~/myplone3.0

Create a pristine Zope instance

Goal

You want to create a pure Zope instance, in which you can use tools like easy_install and yolk to manage Python packages and install Products the usual way.

Recipe

Use this command:

ploneenv $INSTANCE_HOME -m $MKZO --no-requirements
What this does

Calling ploneenv with --no-requirements will create a blank Zope instance that's also a workingenv. This method of installation is perfectly compatible with Plone 2.5 or other Products!

To install packages from the Cheese Shop, you must first activate the environment and then use easy_install, like this:

source $INSTANCE_HOME/bin/activate
easy_install yolk

This will install yolk, a tool that provides a lot of useful functions for querying the metadata of installed setuptools packages and querying the Cheese Shop. For example, if you want a list of all packages that are installed in your Zope instance, run:

yolk -l

Create an instance with Plone 3 from Subversion in it

Goal

You want to try out Plone's latest development version straight from Subversion.

Recipe

Follow the steps from Create a pristine Zope instance and then, after having activated the instance's environment via source $INSTANCE_HOME/bin/activate, do:

easy_install Plone==dev
What this does

This will download and install Plone's current development version. This way you can experience the latest and greatest (and potentially most unstable) Plone.

Create an instance with a Plone 3 release in it

Goal

You want to create a Zope instance with the latest Plone 3 release in it.

Recipe

Use this command:

ploneenv $INSTANCE_HOME -m $MKZO
What this does

This will install the latest Plone version from the Cheese Shop. Right now this is 3.0-r12165, an experimental and arbitrary snapshot of Plone 3 dating back to the 4th of February. Note that it's not related to the real Plone 3.0a2 release, which is the latest official release of Plone 3 and what you normally want to use.

Develop packages for Plone 3

Goal

You want to develop a package for Plone 3.0. We'll call this package mypackage.

Recipe

Follow the steps in Create an instance with Plone 3 from Subversion in it.

Install ZopeSkel and create your package if you haven't one already:

easy_install ZopeSkel
paster create -t plone mypackage

Activate your instance's environment if you haven't yet and install your package in development mode:

source $INSTANCE_HOME/bin/activate
cd mypackage
python setup.py develop
What this does

You are encouraged to create your new Plone 3 modules outside of the Products directory/package. ZopeSkel helps you with quickly setting up a distribution.

Invoking python setup.py develop inside of your newly created project will install your package in development mode.

There are good reasons to still use Products. When you develop a Product, just link it into your instance's Products directory as usual.

Note that you can override Products or packages that come with Plone this way, which enables you to develop parts of Plone itself.

Status quo

Plone 3.0, ploneenv and the Plone egg distribution are under heavy development still. Therefore you might encounter errors while trying out these recipes. Please report those!

There is one known problem with ploneenv, where easy_install attempts to compile Script (Python) files and spews a lot of error messages. However, those error messages are not critical, and the installation succeeds nevertheless.

If you're developing Plone 3 itself, you might want to go for ploneout, which is the mechanism used by most Plone developers who actively develop Plone.

My previous blog on ploneenv has some more pointers and info.

Update: Thanks to Paul Everitt, there is now a ploneenv screencast.

posted at: 19:35 | 2 comments | category: /devel/zope rss | permanent link | add to del.icio.us or digg it


< February 2007 >
SuMoTuWeThFrSa
     1 2 3
4 5 6 7 8 910
11121314151617
18192021222324
25262728   

Feed of all categories: rss rss | atom

Categories: