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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <burak.arslan@arskom.com.tr>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'example:': 0.03; 'detect': 0.07; 'subject:file': 0.07; 'python:': 0.09; 'python': 0.11; 'expects': 0.16; 'from:addr:arskom.com.tr': 0.16; 'from:addr:burak.arslan': 0.16; 'from:name:burak arslan': 0.16; 'message-id:@arskom.com.tr': 0.16; 'received:arskomhosting.com': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'header:User- Agent:1': 0.23; 'file.': 0.24; 'script': 0.25; 'distribute': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'feature': 0.29; "d'aprano": 0.31; 'steven': 0.31; 'file': 0.32; 'running': 0.33; 'basic': 0.35; 'adjust': 0.36; 'application': 0.37; 'to:addr :python-list': 0.38; 'little': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'called': 0.40; 'zip': 0.64; 'more': 0.64; 'nobody': 0.68
Date Wed, 23 Jul 2014 15:23:10 +0300
From Burak Arslan <burak.arslan@arskom.com.tr>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Distributing python applications as a zip file
References <53cf38c2$0$29897$c3e8da3$5496439d@news.astraweb.com>
In-Reply-To <53cf38c2$0$29897$c3e8da3$5496439d@news.astraweb.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.12236.1406118723.18130.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1406118723 news.xs4all.nl 2838 [2001:888:2000:d::a6]:56602
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:75081

Show key headers only | 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