Working with uvx cookieplone: A Few Surprises Along the Way

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

  1. Is this expected behavior, or is there something I'm missing?
  2. Should we be placing addons in src/ or sources/?
  3. Is there a comprehensive guide for the full workflow of creating and integrating addons with the new stack?

Thanks for any insights!

I have placed extra addons in sources, and it works as expected.

The src folder is for the addon created by cookieplone itself.

Do not compare the backend structure created by cookieplone to Buildout, but to an addon.

That's how I understand it.

Not yet. There's an open issue that needs a champion.

Yes. src is taken already by Python package conventions. That is the reason why mxdev uses sources.