title: How do I write a setup.py for a twistd/twisted plugin that works with setuptools, distribute, etc?
body: <p>The <a href="http://twistedmatrix.com/documents/current/core/howto/plugin.html" rel="noreferrer">Twisted Plugin System</a>  is the preferred way to write extensible twisted applications. </p>
  
  <p>However, due to the way the plugin system is structured (plugins go into a twisted/plugins directory which should <em>not</em> be a Python package), writing a proper setup.py for installing those plugins appears to be non-trivial.</p>
  
  <p>I've seen some attempts that add 'twisted.plugins' to the 'packages' key of the distutils setup command, but since it is not really a package, bad things happen (for example, an <code>__init__.py</code> is helpfully added by some tools).</p>
  
  <p>Other attempts seem to use 'package_data' instead (eg, <a href="http://bazaar.launchpad.net/~glyph/divmod.org/trunk/view/head:/Epsilon/epsilon/setuphelper.py" rel="noreferrer">http://bazaar.launchpad.net/~glyph/divmod.org/trunk/view/head:/Epsilon/epsilon/setuphelper.py</a>), but that can also fail in weird ways.</p>
  
  <p>The question is: has anyone successfully written a setup.py for installing twisted plugins which works in all cases?</p>