Edgewall Software

Version 5 (modified by s0undt3ch <ufsATufsoftDOTorg>, 19 years ago) ( diff )

This page documents the 1.4 (latest stable) release. Documentation for other releases can be found here.

Trac Plugins

Since version 0.9, Trac supports plugins that extend the built-in functionality. The plugin functionality is based on the component architecture.

Requirements

To use plugins in Trac, you need to have setuptools, version 0.5a13 installed.

To install setuptools, download the bootstrap module ez_setup.py and execute it as follows:

$ python ez_setup.py setuptools==0.5a13

Installing a Trac Plugin

For a Single Project

Plugins are packaged as Python eggs. That means they are ZIP archives with the file extension .egg. If you have downloaded a source distribution of a plugin, you can run:

$ python setup.py bdist_egg

to build the .egg file.

Once you have the plugin archive, you need to copy it into the plugins directory of the project environment. Also, make sure that the web server has sufficient permissions to read the plugin egg.

For All Projects

Plugins that you want to use in all your projects (such as WebAdmin) can be installed globally by running:

$ python setup.py install

Alternatively, you can just drop the .egg file in the Python site-packages directory.

Setting up the Plugin Cache

Some plugins will need to be extracted by the Python eggs runtime (pkg_resources), so that their contents are actual files on the file system. The directory in which they are extracted defaults to the home directory of the current user, which may or may not be a problem. You can however override the default location using the PYTHON_EGG_CACHE environment variable.

To do this from the Apache configuration, use the SetEnv directive as follows:

SetEnv PYTHON_EGG_CACHE /path/to/dir

This works whether your using the CGI or the mod_python front-end. For FastCGI, you'll need to -initial-env option, or whatever is provided by your web server for setting environment variables.

When using mod_python set the SetEnv PYTHON_EGG_CACHE /path/to/dir inside the <Location ></Location> where you setup mod_python on your apache conf.


See also TracGuide, component architecture

Note: See TracWiki for help on using the wiki.