David Glick: Cookieplone

published Nov 28, 2024

Talk by David Glick at the Plone conference 2024 in Brasilia.

Link to talk information on Plone conference website.

Cookieplone is a project generator for Plone. It has several templates to choose from: backend add-on, frontend add-on, project with both.

It is recommended for Volto 18 with Plone 6.0 or 6.1.

See the Plone documentation.

A brief history of Plone installers. What makes a good installer? Minimal: you don't want to need to install a bunch of things before you can use the installer. Reliable: works each time. Portable: works on your laptop and the server, Linux and Mac (and Windows hopefully). Easy to use, batteries included, flexible. Both easy to use and flexible can be hard to get right.

Why can't you just run `pip install Plone`? You can, then you have the Python packages.  But then you need scripts, configuration, add-ons, databases, maintenance jobs, a front-end, etc.

Long time ago: download a tarball and unpack it. No dependency management.

Buildout came along, this handled dependency management, could create configuration and scripts using recipes. It has served us well. It has a bit of a learning curve. The reliability and portability could be a problem, especially when the server would be different from your laptop, or you did not pin all versions, or a package could no longer be downloaded.

Then we had the Unified Installer and Windows Installer. It was a wrapper around buildout, including all the needed packages and some scripts to make sure you had the right prerequisites.

plonecli / bobtemplates were more in the area of project scaffolds.

Somewhere in the past decade it become possible to install Plone with pip.

You can use Docker to install Plone. Less useful for development.

cookiecutter-plone-starter was the way to start with Volto and Plone 6. It would give you a Plone backend package and run a separate command to generate a Volto frontend.

And this year cookieplone. It was born in May this year during the Axolote sprint in Mexico City.

What is new compared to cookiecutter-plone-starter?

  • It is a mono repo for frontend and backend.
  • There are now minimal differences between an add-on and a project.
  • We now use pnpm-workspaces for the frontend, which helps if you want to try an unreleased version of a package like Volto.

How does it work? It is a wrapper around Cookiecutter, running several templates, and then some actions at the end: modifying some files or deleting files that you don't want. It has custom filters.

What if I prefer Buildout, or don't want Volto, prefer unittest over pytest? Partial answer: cookieplone is opinionated, so no. But we can talk about it. You can contribute. You can also fork it if your company has different opinions.

It is expected that the templates will evolve over time. We will fix bugs or do things differently. How can I update an existing project? You could generate a new one and then copy in the custom parts that you already have.

What's in progress:

  • GitLab pipeline
  • Support for bob templates has recently landed, with some commands to extend an already generated project.
  • Add a documentation section in the generated project.
  • Option to create a Plone distribution.
  • Use hatch for the backend.
  • Run via web-based UI or GitHub code spaces.