A cookiecutter template for building Wagtail and Django packages according to the the Wagtail package maintenance guidelines.
# Shortest one-liner, you will be prompted for important package information.
uvx cookiecutter gh:wagtail/cookiecutter-wagtail-packageThe generated package contains:
- A Django app under
src/with anAppConfig, emptymodels.py, and examplewagtail_hooks.py(Wagtail admin summary item and admin URL registration with i18n support). - A
demo/Wagtail site with home, blog, and search apps, ready to run withjust demo. - A
tests/directory with pytest and pytest-django configured, and a placeholder test. - A
justfilewith recipes for linting, formatting, testing, coverage, and running the demo. - Project configuration with
pyproject.toml(uv build backend),ruff.toml, pre-commit hooks, Prettier, and Stylelint.
The generated package includes GitHub Actions workflows for:
- Running tests and linters on pushes and pull requests.
- Testing against the lowest and highest supported dependency versions, and a compatibility matrix of Python, Django, and Wagtail versions.
- Running tests nightly against the latest Wagtail development version (with optional Slack notifications on failure).
- CodeQL security scanning and GitHub Actions security analysis with zizmor.
- Publishing to PyPI when GitHub releases are created. This requires two additional setup steps:
- Create a pending publisher in PyPI: https://docs.pypi.org/trusted-publishers/creating-a-project-through-oidc/
- Create an environment called "publish" in GitHub: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#creating-an-environment
The following are intentionally left out of the template:
- Frontend build tools (Vite, webpack, esbuild). Many packages don't need a build step, and those that do have varied requirements. Set up a build pipeline based on your package's needs.
- Example models, views, or forms. The generated
models.pyis empty -- thewagtail_hooks.pydemonstrates Wagtail integration, but the package's domain logic is yours to define. - Internationalization scaffolding. While the
wagtail_hooks.pyregisters a JavaScript i18n catalog URL, there is nolocale/directory or example translations. Add these when your package needs them.
Install cookiecutter:
python -m pip install "cookiecutter>=2"
Then run it like so:
cookiecutter git@github.com:wagtail/cookiecutter-wagtail-package.git
It'll ask for some details about you (name and email) and your project.
When it asks for your project name, exclude the "Wagtail" prefix. For example, if your project is called "Wagtail Llamas", set your project name to "Llamas" and accept all the default project name variants it generates (unless you used a special character in the project name).
This project includes reusable agent skills for AI coding agents. Install the project skills with Vercel Lab’s Agent Skills CLI:
npx skills add wagtail/cookiecutter-wagtail-packagecreate-django-package creates a new Wagtail/Django package from the cookiecutter-wagtail-package template. Example prompts:
- "Create a new Wagtail package called 'Wagtail Color Picker' for adding a color field to Wagtail pages"
- "Set up a new Django package called 'django-webhook-relay' for forwarding webhook events to multiple endpoints"
create-django-package also supports extracting Django apps from an existing project to make them reusable as a package. Example prompts:
- "Extract the
myproject/analyticsapp into a standalone Wagtail package called 'Wagtail Analytics'" - "Turn the
utils/markdown_fields.pymodule into a reusable Django package"
package-guidelines-audit audits a Django/Wagtail package against the official Wagtail package maintenance guidelines. Example prompts:
- "Audit this package against the Wagtail package guidelines"
- "Check whether this package's CI and version support are up to date with Wagtail's guidelines"
update-package-from-template updates an existing Wagtail/Django package to align with the latest cookiecutter-wagtail-package template. Example prompts:
- "Compare this package with the latest cookiecutter-wagtail-package template and report any differences"
- "Update this package's tooling and CI to match the latest cookiecutter-wagtail-package template"