Re: Distributing python applications as a zip file
On Wednesday, July 23, 2014 4:43:11 AM UTC-4, Leo jay wrote: But if you use windows and you happen to use multiprocessing, please be aware of this bug I encountered several years ago. https://mail.python.org/pipermail/python-dev/2011-December/115071.html It looks like this was fixed for 3.2. Was the fix ever backported to 2.7? -- Thanks, Alan Isaac -- https://mail.python.org/mailman/listinfo/python-list
Re: Distributing python applications as a zip file
On 23/07/2014 06:30, Gary Herron wrote: On 07/22/2014 09:23 PM, Steven D'Aprano wrote: A little known feature of Python: you can wrap your Python application in a zip file and distribute it as a single file. Really! 20 years of Pythoning, and I'd never seen this! When was this introduced? This post by Brett Cannon is useful: http://sayspy.blogspot.co.uk/2010/03/various-ways-of-distributing-python.html I was trying to track down a presentation in the same vein which I saw him give at EuroPython a few years ago, but I can't seem to find it. It basically says the same thing but it's a slightly clearer read. TJG -- https://mail.python.org/mailman/listinfo/python-list
Re: Distributing python applications as a zip file
On Wed, Jul 23, 2014 at 2:23 PM, Steven D'Aprano st...@pearwood.info wrote: On Linux, you can even hack the zip file to include a shebang line! steve@runes:~$ cat appl #!/usr/bin/env python # This is a Python application stored in a ZIP archive. steve@runes:~$ cat appl.zip appl steve@runes:~$ chmod u+x appl steve@runes:~$ ./appl NOBODY expects the Spanish Inquisition!!! This, by the way, depends on a feature of the zip file format: you start reading from the back, with the key indexes, and then come to the front. It's designed to allow various self-extracting archive formats to be easily unzipped (imagine, if you will, a SFX built for Windows when you're on Unix - rather than try to run the program (with all the difficulties and risks that would entail), you just unzip it), and it works nicely here too. I suppose, then, it would be possible to make a minimal Unix SFX prefix: #!/usr/bin/env unzip\n on the beginning of a zip should do the job :) (Yes, I'm aware that that violates most of the point of an SFX, in that the target system doesn't need to have pkunzip installed, but it's still neat how short it can be.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Distributing python applications as a zip file
Am 23.07.2014 06:23, schrieb Steven D'Aprano: A little known feature of Python: you can wrap your Python application in a zip file and distribute it as a single file. The trick to make it runnable is to put your main function inside a file called __main__.py inside the zip file. Look here: http://legacy.python.org/dev/peps/pep-0441/ https://pypi.python.org/pypi/pyzzer https://pypi.python.org/pypi/pyzaa/0.1.0 Or write your own little utility to create such a thing, it's not complicated. Thomas -- https://mail.python.org/mailman/listinfo/python-list
Re: Distributing python applications as a zip file
On Wed, Jul 23, 2014 at 12:23 PM, Steven D'Aprano st...@pearwood.info wrote: A little known feature of Python: you can wrap your Python application in a zip file and distribute it as a single file. The trick to make it runnable is to put your main function inside a file called __main__.py inside the zip file. Here's a basic example: steve@runes:~$ cat __main__.py print(NOBODY expects the Spanish Inquisition!!!) steve@runes:~$ zip appl __main__.py adding: __main__.py (stored 0%) steve@runes:~$ rm __main__.py steve@runes:~$ python appl.zip NOBODY expects the Spanish Inquisition!!! On Linux, you can even hack the zip file to include a shebang line! steve@runes:~$ cat appl #!/usr/bin/env python # This is a Python application stored in a ZIP archive. steve@runes:~$ cat appl.zip appl steve@runes:~$ chmod u+x appl steve@runes:~$ ./appl NOBODY expects the Spanish Inquisition!!! It's not quite self-contained, as you still need to have Python installed, but otherwise it's a good way to distribute a Python application as a single file that users can just copy and run. But if you use windows and you happen to use multiprocessing, please be aware of this bug I encountered several years ago. https://mail.python.org/pipermail/python-dev/2011-December/115071.html -- Best Regards, Leo Jay -- https://mail.python.org/mailman/listinfo/python-list
Re: Distributing python applications as a zip file
On 07/23/14 07:23, Steven D'Aprano wrote: A little known feature of Python: you can wrap your Python application in a zip file and distribute it as a single file. The trick to make it runnable is to put your main function inside a file called __main__.py inside the zip file. Here's a basic example: steve@runes:~$ cat __main__.py print(NOBODY expects the Spanish Inquisition!!!) steve@runes:~$ zip appl __main__.py adding: __main__.py (stored 0%) steve@runes:~$ rm __main__.py steve@runes:~$ python appl.zip NOBODY expects the Spanish Inquisition!!! does it support package_data? or more specifically, does pkg_resources.resource_* detect that the script is running from a zip file and adjust accordingly? -- https://mail.python.org/mailman/listinfo/python-list
Re: Distributing python applications as a zip file
On Wed, 23 Jul 2014 15:23:10 +0300, Burak Arslan wrote: On 07/23/14 07:23, Steven D'Aprano wrote: A little known feature of Python: you can wrap your Python application in a zip file and distribute it as a single file. [...] does it support package_data? or more specifically, does pkg_resources.resource_* detect that the script is running from a zip file and adjust accordingly? No idea, sorry. Why don't you try it and see? Please let us know what you find. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Distributing python applications as a zip file
A little known feature of Python: you can wrap your Python application in a zip file and distribute it as a single file. The trick to make it runnable is to put your main function inside a file called __main__.py inside the zip file. Here's a basic example: steve@runes:~$ cat __main__.py print(NOBODY expects the Spanish Inquisition!!!) steve@runes:~$ zip appl __main__.py adding: __main__.py (stored 0%) steve@runes:~$ rm __main__.py steve@runes:~$ python appl.zip NOBODY expects the Spanish Inquisition!!! On Linux, you can even hack the zip file to include a shebang line! steve@runes:~$ cat appl #!/usr/bin/env python # This is a Python application stored in a ZIP archive. steve@runes:~$ cat appl.zip appl steve@runes:~$ chmod u+x appl steve@runes:~$ ./appl NOBODY expects the Spanish Inquisition!!! It's not quite self-contained, as you still need to have Python installed, but otherwise it's a good way to distribute a Python application as a single file that users can just copy and run. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Distributing python applications as a zip file
On 07/22/2014 09:23 PM, Steven D'Aprano wrote: A little known feature of Python: you can wrap your Python application in a zip file and distribute it as a single file. The trick to make it runnable is to put your main function inside a file called __main__.py inside the zip file. Here's a basic example: steve@runes:~$ cat __main__.py print(NOBODY expects the Spanish Inquisition!!!) steve@runes:~$ zip appl __main__.py adding: __main__.py (stored 0%) steve@runes:~$ rm __main__.py steve@runes:~$ python appl.zip NOBODY expects the Spanish Inquisition!!! On Linux, you can even hack the zip file to include a shebang line! steve@runes:~$ cat appl #!/usr/bin/env python # This is a Python application stored in a ZIP archive. steve@runes:~$ cat appl.zip appl steve@runes:~$ chmod u+x appl steve@runes:~$ ./appl NOBODY expects the Spanish Inquisition!!! It's not quite self-contained, as you still need to have Python installed, but otherwise it's a good way to distribute a Python application as a single file that users can just copy and run. Really! 20 years of Pythoning, and I'd never seen this! When was this introduced? Gary Herron -- https://mail.python.org/mailman/listinfo/python-list
Re: Distributing python applications as a zip file
On Tue, Jul 22, 2014 at 9:23 PM, Steven D'Aprano st...@pearwood.info wrote: A little known feature of Python: you can wrap your Python application in a zip file and distribute it as a single file. The trick to make it runnable is to put your main function inside a file called __main__.py inside the zip file. snip It's not quite self-contained, as you still need to have Python installed, but otherwise it's a good way to distribute a Python application as a single file that users can just copy and run. And if you want something nearly completely self-contained (probably modulo dynamic linking), it seems that there's PEX (http://pex.readthedocs.org/en/latest/ ). Cheers, Chris -- https://mail.python.org/mailman/listinfo/python-list
Distributing Python Applications
Hello, It has been such a painful thing for me. As I made a program to encrypt files, now I want to distribute that program over other computers. I created .EXE file with py2exe but the dist folder makes around 2 mb and it restricts for the python DLL to be within the same folder. Is there any easy way to get this thing done in just one exe file? I mean if I do interfacing with C/C++ will it work for me and if I do interfacing with C/C++ will it be necessary on the other computer to have python installed on it? Thanks in advance... -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python Applications
[EMAIL PROTECTED] wrote: Hello, It has been such a painful thing for me. As I made a program to encrypt files, now I want to distribute that program over other computers. I created .EXE file with py2exe but the dist folder makes around 2 mb and it restricts for the python DLL to be within the same folder. Is there any easy way to get this thing done in just one exe file? I mean if I do interfacing with C/C++ will it work for me and if I do interfacing with C/C++ will it be necessary on the other computer to have python installed on it? Thanks in advance... No need for python to be installed. Don't worry about 2 MB downloads. Probably, if users are savvy enough to need encryption, they have the download speeds and hard drive space to handle 2 MB. Check out pyinstaller also, but what your really need is Innosetup. Its beautiful. James -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python Applications
En Sat, 10 Feb 2007 09:21:29 -0300, [EMAIL PROTECTED] escribió: It has been such a painful thing for me. Ouch... why was that? Programming in Python, or using py2exe? As I made a program to encrypt files, now I want to distribute that program over other computers. I created .EXE file with py2exe but the dist folder makes around 2 mb and it restricts for the python DLL to be within the same folder. Is there any easy way to get this thing done in just one exe file? Perhaps... but what would you gain? Most programs include, apart from the main executable: manual, license, readme file, release notes, installation guide, other resources, etc. You can use an installer like Inno Setup to package nicely all required pieces into a single distributable file. For simple programs, even a self-extracting .zip would suffice. I mean if I do interfacing with C/C++ will it work for me and if I do interfacing with C/C++ will it be necessary on the other computer to have python installed on it? I don't understand what are you asking... You can extend and/or embed Python using C. And you already know py2exe, obviously: the idea is to *not* require a previous Python install in order to run your application. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list