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

Matthew Glubb matt at madebykite.com
Sat Apr 5 06:47:53 EDT 2008


Hi Zooko,

Thanks for your comments. I fixed it. The solution was very simple.  
Just include twisted/plugins/... in my egg. It gets picked up  
automatically because PYTHONPATH includes the path to my egg.

Regards,


Matt

On 5 Apr 2008, at 02:57, zooko wrote:
>
> 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"  
> hook.
>
> 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 behavior.
>
> Regards,
>
> Zooko
>
>
> 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' ] }
>      setup(**setup_args)
>
>
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python





More information about the Twisted-Python mailing list