Ok, so I got one step further... I changed the code line for actual_plugin to have this value:
actual_plugin = 'calibre.gui2.actions.foo_plugin:FooAction'
This got my plugin to appear on the preferences dialog. However my context menu action doesn't appear. So I restarted Calibre (in case the menus are built at startup)... no luck and also the plugin is no longer listed in the Preferences dialog until I manually add it again.
If I list the plugins using calibre-customize it appears in the list, and I can see the zip file in the Roaming\calibre\plugins folder.
There seems to be some trick I am missing though to (a) get the plugin to appear back in the Preferences dialog after a restart, and (b) to get my menu items to actually appear (which may or may not be related to the implementation).
I have tried copying directly an implementation from show_book_details.py into my FooAction class to prove it is not part of the code and it makes no difference? That version is now attached.
Apologies for being a pain for asking.