Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75081

Re: Distributing python applications as a zip file

Date 2014-07-23 15:23 +0300
From Burak Arslan <burak.arslan@arskom.com.tr>
Subject Re: Distributing python applications as a zip file
References <53cf38c2$0$29897$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.12236.1406118723.18130.python-list@python.org> (permalink)

Show all headers | View raw


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?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Distributing python applications as a zip file Steven D'Aprano <steve@pearwood.info> - 2014-07-23 04:23 +0000
  Re: Distributing python applications as a zip file Gary Herron <gary.herron@islandtraining.com> - 2014-07-22 22:30 -0700
  Re: Distributing python applications as a zip file Chris Rebert <clp2@rebertia.com> - 2014-07-22 22:46 -0700
  Re: Distributing python applications as a zip file Tim Golden <mail@timgolden.me.uk> - 2014-07-23 08:20 +0100
  Re: Distributing python applications as a zip file Chris Angelico <rosuav@gmail.com> - 2014-07-23 17:59 +1000
  Re: Distributing python applications as a zip file Thomas Heller <theller@ctypes.org> - 2014-07-23 10:07 +0200
  Re: Distributing python applications as a zip file Leo Jay <python.leojay@gmail.com> - 2014-07-23 16:43 +0800
    Re: Distributing python applications as a zip file Alan <alan.isaac@gmail.com> - 2014-07-24 05:19 -0700
  Re: Distributing python applications as a zip file Burak Arslan <burak.arslan@arskom.com.tr> - 2014-07-23 15:23 +0300
    Re: Distributing python applications as a zip file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-24 00:55 +0000

csiph-web