How do I make a zope package?
After installing your instance it is time to start to develop new zope packages with the functionality that your site needs. As usual, you start at ~/myenv and source the activation script:
$ cd ~/myenv
$ source bin/activate
Now you create and initialize the directory for your development package:
$ mkdir mypackage
$ cd mypackage
$ buildout init
The last command creates the basic structure of a buildout directory. You have to finish the work:
# prepare this folder for setuptools
$ touch setup.py
# create the source folder
$ mkdir -p src/mypackage
# and make it a package
$ touch src/mypackage/__init__.py
You'll need a buildout.cfg. Here is a typical one for a development package:
[buildout]
develop = .
parts = test
[test]
recipe = zc.recipe.testrunner
eggs = mypackage [test]
This configuration will create a command test under the bin folder which will execute all the tests for your package.
You'll need a setup.py file too.Of course, you should study setuptools first, but this one is good enough to start hacking:
import os
from setuptools import setup, find_packages
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup (
name='mypackage',
version='0.1',
author = "Willie H. Hacker",
author_email = "willie@acme.com",
description = "A good package",
license = "GPL",
keywords = "zope3",
classifiers = [
'Environment :: Web Environment',
'Intended Audience :: Developers',
'Programming Language :: Python',
'Natural Language :: English',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Zope3'],
packages = find_packages('src'),
include_package_data = True,
package_dir = {'':'src'},
extras_require = dict(
test = [
'zope.testing',
'zope.app.container [test]',
],
),
install_requires = [
'setuptools',
'zope.interface',
'ZODB3',
'zope.schema',
'zope.app.container',
'zope.app.content',
'zope.dublincore',
],
dependency_links =
['http://download.zope.org/distribution'],
zip_safe = False,
)
Of course, you'll have to edit some fields, like name, author and, more important the install_requires.
