Improving bobtemplates.plone


as Asko wrote in his final sprint report:
I work recently on improving bobtemplates.plone and providing a better user story there.

The current state

is, that I've implemented a first subcommand for dx_content_type already and still working on moving the theming part also in a subcommand. So that one will use the plone_addon template to create a package and can use later one or more subcommands (subtemplates) to add other functionallity into the existing package.

Further subtemplates could be behaviors, portlets and so on.

The existing subtemplates are not complete yet, but as soon as the general structure is solid, we can improve the individual templates in time.


First you create a plone_addon package:

mrbob -O bobtemplates.plone:plone_addon

then you change into the created package and create for example one or more a dexterity content types:

mrbob bobtemplates.plone:dx_content_type

or you can create a theme inside the package:

mrbob bobtemplates.plone:plone_theme

Broken package namespace

bobtemplates.plone currently has no real namespace which I'm now fixing: so that one can import from bobtemplates.plone.hooks and not from bobtemplates.hooks. This also means that we have to change the usage of our package a bit.

mrbob -O bobtemplates:plone_addon

will become:

mrbob -O bobtemplates.plone:plone_addon

More modular structure

I just startet to move the python code for every subtemplate into it's own file like: or These files then also import generic functions from This way we have a clean structure which can grow without losing control.

Still a lot of work to do

  • finish the transion of the theme package template into the theme subtemplate
  • find a good way to update buildout-files
  • integrate the work from @Alexander_Loechel to have the tox setup for testing
  • add docs and make a release

Nice to have in the future

  • add a project buildout skeleton template
  • more templates

Suggestions, ideas, help?

I would like to get some feedback from you and of course every help is hightly appreciated.
The target is, to come up soon with a very useful helper to start or extend Plone projects, to make it easier to develop with Plone.


I'm expecting the initial templates to become clean and minimal because of this, and also it to be simple to provide in-house sub-templates / sub-commands on top of the community maintained bobtemplates.plone. That would encourage to use bobtemplates.plone also as a base for opinionated in-house packages instead of forking it and losing all the new things.


Seems that bobtemplates.plone is quite a busy place lately:

You are massively refactoring it, Alexander wants to add his best practices documentation and the TOX configuration and I want to get rid of and replace that by virtualenv :smile:

@MrTango do you have an estimated ETA? Or can we, Alexander and me, do our pull requests while you are refactoring?


@Alexander_Loechel showed me already his PR, the only think I would change there, to go back to bobtemplates folder. Means not moving all templates under src/bobtemplates. Or do you thing this is the way to go?
Without this, the most changes are not inside the templates right? So merging them shouldn't be a problem.
I think I'll work on this weekend on that too and maybe reach already a good point to merge.

1 Like

Could you detail what you're aiming at there? To not recommend bootstrapping with a bare naked Python anymore?

It's no longer supported by the latest setuptools.

@Rotonen the way to go is to use:

virtualenv .


pip install zc.buildout

If the virtualenv and the buildout directory are not the same, then also:

buildout bootstrap

In the buildout directory.
You can also use a requirments.txt with pinned versions of setuptools and zc.buildout.
Or in the future pipenv instead of pip + requirements.txt + virtualenv.

1 Like

I had for now given up on setuptools > 33.1.1. Thank you.

The PLIP is

1 Like

@MrTango I just move that folder back into package root, so that you could easier move forward.

In the long run I would like to have it in a src folder as this package should also follow best practices.

I just tested this with the version from github.

git clone
cd bobtemplates.plone
virtualenv .
source bin/activate
python develop

After that I tried the command mentioned above:

mrbob -O bobtemplates.plone:plone_addon

But the output I got was:

  File "/usr/lib/python2.7/importlib/", line 37, in import_module
ImportError: No module named plone

I'm assuming there must be a branch with the plone name space.

@pigeonflight yes it's still here:

This is the code that will make it into the 2.0 version?

I'll merge it after I finshed at least the refactoring of the theme into a subcommand/subtemplate.
So that we have the same functionality as now.

yes, thats the plan.

I'll make a 1.x release before and also create a 1.x branch before merging my changes.

Okay, I've switched to the subcommand branch

 git checkout MrTango_subcommands
 mrbob -O bobtemplates.plone:plone_addon

Now I get

File "/usr/lib/python2.7/importlib/", line 37, in import_module
ImportError: No module named hooks 

I guess that's the namespace work that you said is still outstanding.

are you sure that you are using the mrbob from the branch?
Can you go online on gitter?

I fixed the plone_addon template, should work now.
There where the change of the namespace missing :wink:

Yup! Works now.
I actually found the problem just before noticing that you fixed it in the .mr.bob.ini file :slight_smile:

1 Like