Richard Jones' Log: Sane Python application packaging?
I've got an application that I'd like to make more user-friendly to install.
- On OS X and Windows applications have everything (program, libraries, data) bundled. This is good as it removes issues around library compatibility and installation. In a previous job I've handled installing on these platforms but I also had ready access to them to develop & test on and now as a FOSS developer I don't.
- On OS X I know about py2app. Since there's no "installation" this is effectively done. That'll help.
- On Windows I know about py2exe but I still need to create an installer for the application (to add it to "Program Files", the start menu and possibly associate file extensions). There's a link to Inno Setup from the py2exe tutorial and I think it'll help.
- On Linux applications may be a stand-alone bundle but are encouraged to use a standard install pattern (programs in /usr/bin, libraries in /usr/lib/, data files in /usr/share). If I don't follow that pattern I won't get picked up by Linux distributions.
- In the Python world we have two technologies: distutils and setuptools. Parts of distutils are used in py2app and py2exe. At first glance distutils and setuptools appear to be suitable for the Linux case, except...
- Installing with distutils can cause problems if the internal library contents change, resulting in asking users to manually remove any old install.
- Python eggs, and the associated Python library search path / site.py shenanigans, cause developer and end-user pain when an application has its own local copy of an installed egg library. Many scary user warnings out on the console, and also possibly incorrect behavior. virtualenv can help solve this but would require bundling a build of Python with the application.
- Shared libraries can cause compatibility issues that I'd like to avoid.
So, does anyone have any advice?
- Is there a py2exe/py2app for Linux that I've not found? Do I have to use auto(conf|tools)?
- I don't believe I should package Python 2.5 but if I'm not using a "local" version then I've a good chance of running into site-packages egg issues and I'd rather not have to:
import sys sys.path = [e for e in sys.path if not e.endswith('site-packages') and not e.endswith('.egg')]at the start of my application.
- Also, are there handy systems I could access to run my py2app/py2exe?
Aside: having just finished writing this post, proof-reading it and looking for one more link I stumbled upon this and this and the huge discussion that lead up to those. The discussion appears to be focusing on packages (libraries) rather than applications.