Here is the current state of my twistd
plugin, which is located in project_root/twisted/plugins/my_plugin.py
:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from zope.interface import implements
from twisted.plugin import IPlugin
from twisted.python.usage import Options
from twisted.application import internet, service
from mylib.io import MyFactory
class Options(Options):
"""Flags and options for the plugin."""
optParameters = [
('sock', 's', '/tmp/io.sock', 'Path to IO socket'),
]
class MyServiceMaker(object):
implements(service.IServiceMaker, IPlugin)
tapname = "myplugin"
description = "description for my plugin"
options = Options
def makeService(self, options):
return internet.UNIXServer(options['sock'], MyFactory())
__init__.py
file in project_root/twisted/plugins/
twistd
doesn't show my plugin when run from the project's root directorypython setup.py develop --user
and it is importable from anywhereAny ideas?
As suspected, it was something very simple: I needed to instantiate an instance of MyServiceMaker
, so simply adding service_maker = MyServiceMaker()
at the bottom of the script fixes the issue.