old blog,

Hooking zope.component to any python project

Izhar Firdaus Izhar Firdaus Follow Support Nov 02, 2010 · 1 min read
Hooking zope.component to any python project
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.
Zope Component Architecture is a set of libraries used for aiding in writing component based applications using python. It provides some useful libraries to handle common patterns such as factory, adapter, multiadapter, and subscribers.

In Inigo, we utilizes Zope Component Architecture widely in our development process as it helps us in decoupling components in our system.

Anyway, lets get straight to the point of this post. Basically, what I'll go through in this post would be one method of hooking zope.component together with a configure.zcml into your current python project. It might not be the best way, but the simplest that I know of.


  • You'll need to have these installed in your python environment: zope.component, zope.configuration.
  • Your project is packaged as an egg (probably possible if not as an egg, but I never tried that)

Setting up

In your project egg module directory, create a file called configure.zcml with this content:

<configure xmlns="http://namespaces.zope.org/zope">

This file will be the starting point for your project's component registration

Loading configure.zcml

In your python project, probably right at the start of the main() function, add this:

from zope.configuration.xmlconfig import xmlconfig
from StringIO import StringIO
<configure xmlns="http://namespaces.zope.org/zope">
<include package="your.project.egg.module"/>

Thats it, and you now can use ZCA in your app like you do in Zope.
Written by Izhar Firdaus Follow Support
I'm a system architect, data engineer and developer advocate with passion in Free / Open Source software, entrepreneurship, community building, education and martial art. I take enjoyment in bridging and bringing together different FOSS technologies to help businesses and organizations utilize IT infrastructure to aid and optimize their business and organizational process.

New blog design

Ok i got bored with the old theme.Changed to a new one. This time, its relatively mobile-friendly, mainly utilizes CSS classes from J...

In old blog, Oct 31, 2010

« Previous Post

Fedora 14 Released!!!!!

Read the release announcementGrab your release using direct download here: http://fedoraproject.org/en/get-fedoraOr torrents here : ...

In old blog, Nov 03, 2010

Next Post »