Hey Plone community!
I've been diving into building addons with the new uvx cookieplone
tool for Plone 6.1.1, and I encountered some quirks that I thought might be useful to share. Maybe I'm missing something obvious, but the documentation hasn't led me in the right direction yet.
The mx.ini Confusion
First, after creating a basic addon with uvx cookieplone
, I tried to include it in my project using mxdev. This is where things got confusing!
When trying to add an entry in mx.ini like this:
[test]
url = src/test
vcs = fs
Only to be greeted with:
Directory 'sources/test' for package 'test' doesn't exist.
Turned out I needed something like this:
[settings]
sources-dir = ./src
[test]
url = test
vcs = fs
This brings me to a question: Should we be using sources
instead of src
to follow mxdev conventions? I'm sticking with src
for now since that's what the cookiecutter templates seem to use, but I'm curious if I'm going against best practices here.
The Missing Modules Maze
After getting the addon recognized, running make install
failed with:
ImportError: Module test.setuphandlers has no global populate_portal
Digging into the generated code, I found that while the template creates a setuphandlers
directory, it doesn't add the necessary populate_portal
function to the __init__.py
file!
After fixing that one, I hit another error:
ImportError: Module test has no global services
Turns out the template includes references in configure.zcml
to non-existent packages:
xml
<include package=".services" />
<include package=".subscribers" />
But it doesn't create these directories. I had to either remove these lines or create the missing directories.
What I'd Love to Know
- Is this expected behavior, or is there something I'm missing?
- Should we be placing addons in
src/
orsources/
? - Is there a comprehensive guide for the full workflow of creating and integrating addons with the new stack?
Thanks for any insights!