30. Creating reusable packages with eggs¶
We already created an egg much earlier.
Now we are going to create a feature that is completely independent of our ploneconf site and can be reused in other packages.
To make the distinction clear, this is not a package from the namespace
ploneconf but from
We are going to add a voting behavior.
For this we need:
- A behavior that stores it’s data in annotations
- A viewlet to present the votes
- A bit of css
We move to the
src directory and call a script called
zopeskel from our projects bin-directory.
$ mkdir src $ cd src $ ../bin/zopeskel
This returns a list of available templates we might use. We choose dexterity since it is pretty small but already has some of the right dependencies we need.
$ ../bin/zopeskel dexterity
We answer some questions:
- Enter project name:
- Expert Mode? (What question mode would you like? (easy/expert/all)?) [‘easy’]:
- Version (Version number for project) [‘1.0’]:
- Description (One-line description of the project) [‘Example Dexterity Product’]:
- Grok-Based? (True/False: Use grok conventions to simplify coding?) [True]:
- Use relations? (True/False: include support for relations?) [False]:
We have to modify the generated files slightly.
setup.py, we completely remove the variables setup_requires and paster_plugins. These are required for features that are rarely used and add a lot of code into the source directory that we don’t want. To the
install_requires list, we add an entry for
We just delete the file
tests.py. This is an outdated test system, we don’t want you to start from there.
profiles/default/types.xml we just delete also. We won’t define new types.