Eclipse, PyDev, Omelette and buildout
Bring on the code completion
I've been setting up a development environment for a new project based on Plone 3.1. This one, I have to run on Windows (shock!), but it turns out it's not all bad.
I first set up a buildout, including the Python Win32 extensions and the mingw32 compiler (see the README.txt in any buildout generated from the plone3_buildout ZopeSkel template). With this, we get all the various parts of Zope and Plone in one directory.
To get code completion on all Zope and Plone code (well, most of it anyway), I used collective.recipe.omelette in my buildout to create a source directory comprising all the Plone eggs. I had to amend the recipe a bit so that it generates __init__.py files in the directories it creates. This is actually fairly cool, because it means that the parts/omelette directory is a valid PYTHONPATH. I think this will make it easier to use mod_wsgi and such things as well.
Omelette relies on symlinks. On NTFS, you can create directory hardlinks using a tool called junction. I've amended the omelette recipe so that it can use junction to create links on Windows (presuming you have Junction installed and present in your PATH). I also had to add some fairly cumbersome uninstall logic to manually unlink all junctions. Without that, buildout had a habit of deleting all the Zope and Plone source code, as things like shutil.rmtree (and deletes in Windows Explorer or a DOS prompt) follow links!
With this, I could add parts/omelette and parts/zope/lib/python as source folders in the PyDev project configuration.
I've also created launchers for buildout and Zope. The Zope one is only partially working. I think it forks the process and thus it doesn't shut down properly if you just terminate the job in Eclipse. I've also not yet managed to get PyDev debugging to work on a live Zope process. If anyone's got any tips, let me know. :)
David Glick is hopefully going to help put some tests around the revisions to collective.recipe.omelette and then get a release out in not too long. Until then, you'll need to use the trunk of the recipe as a develop egg.