[Twisted-Python] Assistance with using Twisted with "pyinstaller"
Hi, we're trying to using pyinstaller to create single-directory distributions of our Twisted/python server on Linux. Wondering if anyone has accomplished this? I googled and checked the archives, but there seems to be no concrete information available. I'm real new to pyinstaller and not really familiar with twisted internals, so not sure where to start with this, particularly whether to package our_server.tac, or the twistd script, or the our_server.py as the starting point to bundle all of this stuff together. If anyone's done this successfully, or failed miserably, would be interested in getting details. Thanks, Ken
On 5 Jan 2010, at 20:48, Ken MacDonald wrote:
Hi, we're trying to using pyinstaller to create single-directory distributions of our Twisted/python server on Linux. Wondering if anyone has accomplished this? I googled and checked the archives, but there seems to be no concrete information available.
Sorry to be negative, but I've not managed to get pyinstaller working with twisted. The reason I'm posting is that I have managed to get bbfreeze and cx_freeze working. This is all about 6 months old, so newer versions might be different, but to summarise: cx_Freeze put everything into an executable zip file so you are left with one main binary and a handful of .so objects for python C modules (unless you patch the Python build to build static). I had to switch to bbfreeze because I needed to use Nevow and there were too many hoops to jump through to make it work with the data files accessed relative to __file__. bbfreeze works with eggs, so it works with Nevow or anything else that uses data files, but the down side is that the result isn't zipped up into one executable. I'm about to reopen the whole freezing thing for a new project, so I may be able to report back in a few weeks.
I'm real new to pyinstaller and not really familiar with twisted internals, so not sure where to start with this, particularly whether to package our_server.tac, or the twistd script, or the our_server.py as the starting point to bundle all of this stuff together. If anyone's done this successfully, or failed miserably, would be interested in getting details.
I dropped the tac file to make it easier to specify the entrypoint. To do this while still getting all the twistd goodness requires some hacking, but it isn't really necessary. You can use the tac file (better to change the extension to .py though) and put a few imports in the file that are only there to pull in dependencies that the freezing program can't find. It's basically an iterative thing - build it, note the missing dependencies, import them, repeat. Good luck.
Thanks, I'll keep cx/bb-Freeze in mind if pyinstaller doesn't work out. I did get some tips from one of our internal guys; they had built a project successfully with Twisted & pyinstaller some time back. I'm trying to figure out the details of what went on there. Seems that they made an <appname>.py which imported Twisted's UnixApplicationRunner() which then imported what had been the .tac file (renamed to <appname>tac.py) to launch the server. Still working out the details, imports, etc., but appears that <appname>.py took over much of the functionality that twistd was providing and made it into more of a straightforward python app. We'll see how this goes. Ken On Wed, Jan 6, 2010 at 5:03 AM, Paul Thomas <spongelavapaul@googlemail.com>wrote:
On 5 Jan 2010, at 20:48, Ken MacDonald wrote:
Hi, we're trying to using pyinstaller to create single-directory distributions of our Twisted/python server on Linux. Wondering if anyone has accomplished this? I googled and checked the archives, but there seems to be no concrete information available.
Sorry to be negative, but I've not managed to get pyinstaller working with twisted.
The reason I'm posting is that I have managed to get bbfreeze and cx_freeze working. This is all about 6 months old, so newer versions might be different, but to summarise:
cx_Freeze put everything into an executable zip file so you are left with one main binary and a handful of .so objects for python C modules (unless you patch the Python build to build static). I had to switch to bbfreeze because I needed to use Nevow and there were too many hoops to jump through to make it work with the data files accessed relative to __file__.
bbfreeze works with eggs, so it works with Nevow or anything else that uses data files, but the down side is that the result isn't zipped up into one executable.
I'm about to reopen the whole freezing thing for a new project, so I may be able to report back in a few weeks.
I'm real new to pyinstaller and not really familiar with twisted internals, so not sure where to start with this, particularly whether to package our_server.tac, or the twistd script, or the our_server.py as the starting point to bundle all of this stuff together. If anyone's done this successfully, or failed miserably, would be interested in getting details.
I dropped the tac file to make it easier to specify the entrypoint. To do this while still getting all the twistd goodness requires some hacking, but it isn't really necessary. You can use the tac file (better to change the extension to .py though) and put a few imports in the file that are only there to pull in dependencies that the freezing program can't find. It's basically an iterative thing - build it, note the missing dependencies, import them, repeat.
Good luck.
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
participants (2)
-
Ken MacDonald
-
Paul Thomas