Search code examples
pythontracegg

How to install Trac Plugin and what is a python egg?


In Trac on Admin -> Plugins there is an option to install Plug-ins. Now this option expect you to upload an Python egg.

This would be all well but for the fact that all the Trac plug-ins I found are either plain .py files or zip files and are incompatible with the upload function (I tried it).

This leaves my with a bunch of questions:

  • Are there any Trac plug-ins which come as an Python egg?
  • What is an (Trac compatible) Python egg?
  • Is it difficult to repackage an .py file into a Trac compatible Python egg?
  • If not: how is it done?

Solution

  • Answers to your questions in order.

    • Python eggs are binary packages which contain the code for the application and some metadata. They're not very different from debs or rpms in this sense. The egg itself is basically just a zip file which contains all the above mentioned files with specific names and layouts. For more information on eggs (the format and how to create them), please refer to http://www.ibm.com/developerworks/library/l-cppeak3.html. It's probably a little dated since the future (and present) of python packaging is a little hazy.
    • A trac plugin is a python program that uses the Trac plugin API to extend the functionality of trac. It can be packaged as an egg.
    • If your package is properly laid out and contains a setuptools/distribute setup.py file, then issuing the command python setup.py bdist_egg will create a .egg file for you. For details on this please refer to this(a little dated but complete) and this (more upto date but still in progress). The Trac Growl plugin mentions this on it's documentation page.
    • Please see above point.