Cookieplone and "... is not a valid Python identifier"

OK, I admit I am not quick today, but when I ran cookieplone a few times to generate a Volto project, I kept having to answer differently the question of the "Python Package Name", until I finally looked up the error and understood that I should not include hyphens or periods in the answer.

I know philosophically the problem of trying to provide "too much" information, but would there be a way to provide a hint on what a correct answer should include (or not include)?

Here is the (rather dry, but official) answer:

Here is a more readable answer provided by Perplexity:

  • Package names must be valid identifiers: they must start with a letter or underscore, and only contain letters, digits, or underscores.​
  • Hyphens ('-') are not allowed, so 'imsss-2025' is invalid.​
  • The most common convention is to use all lowercase letters and underscores for readability
1 Like

A post was split to a new topic: Running cookieplone several times

Thanks for putting this up.

I remember there was a recent issue with a repo starting with a year in the namespace.

Since this is usually a monorepo that has to cover JavaScript and Python namespaces, the resulting names should make sense in both worlds.

Maybe you invest a little bit love in the cookieplone-templates to improve the prompt messages. It is worth the effort. I learned a lot while fighting cookiecutter-plonestarter until its evolution to cookieplone. I filed in some issues too (and later actual PR code) related to prompts for the case styling / naming of the organisation for the git repos.

It is difficult for the developers of the templates to predict all the traps in advance.

First thing I want to say is: Both of you are 1000% correct, and I want to also point out

  1. Cookieplone (cookiecutter) validations should be done in a different way, allowing users to fix their mistakes
  2. cookieplone-templates should have better error messages and unified validations

The first one is a bit complex at the moment. Cookieplone was created to be a simple wrapper around cookiecutter meaning we rely on cookiecutter:

  • Build the form from cookiecutter.json
  • Ask all the questions
  • Compute all the values that begin with __
  • Process the template folder

To properly fix the issue with lack of automatic feedback we would need to either:

  • Improve cookiecutter to run the validation after each answer – and add support for custom validators to the cookiecutter.json file
  • Implement our own form implementation on cookieplone and just use the template folder processing from cookiecutter

I would love if we, as a community, discuss what to do next (consider the idea of dumping cookiecutter in favor of copier, cruft or other templating solution), write a roadmap and use the upcoming sprints to get it done.

1 Like

Stumbled across this issue just now...

1 Like