[Twisted-Python] Packaging a Twisted app as an Egg

zooko zooko at zooko.com
Fri Apr 4 21:57:49 EDT 2008

On Apr 4, 2008, at 12:35 PM, Matthew Glubb wrote:
> I am looking to package a twisted application that relies on twistd  
> as an egg but I am concerned as to how twistd will be aware of the  
> my package.
> How do I make twistd aware of my application if it is packaged as  
> an egg? Is this possible? Do I just create my own stub to twistd  
> that takes care of ensuring that twisted/plugins/myapp.py is in  
> Python's path?

I'm not sure if this solves your problem (because I don't know why  
the twistd script doesn't already succeed at importing twisted from  
the egg), but one option is to use the setuptools "console scripts"  

Get the Twisted 8 source code and apply the following patch.  Then  
whenever you install this patched version of twisted, it will install  
a twistd that imports the associated version of Twisted, even from an  
egg.  As an added bonus, it will make a twistd executable for the  
local platform, including Windows, although I haven't tested that  



Index: setup.py
--- setup.py	(revision 23203)
+++ setup.py	(working copy)
@@ -86,6 +86,7 @@
              setup_args['install_requires'] = requirements
          setup_args['include_package_data'] = True
          setup_args['zip_safe'] = False
+        setup_args['entry_points'] = { 'console_scripts': [ 'twistd  
= twisted.scripts.twistd:run' ] }

More information about the Twisted-Python mailing list