Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'skip:# 20': 0.03; 'pypi': 0.04; 'wrapper': 0.07; 'python': 0.08; 'instance.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'wrote:': 0.14; 'from:addr:acm.org': 0.16; 'received:198.144': 0.16; 'setuptools': 0.16; 'stuff': 0.22; 'trying': 0.23; 'versions': 0.23; '(or': 0.24; 'code': 0.24; '(in': 0.26; 'script': 0.27; 'seeing': 0.28; 'installed': 0.28; 'skip:p 30': 0.28; 'import': 0.29; 'received:198': 0.32; 'header:X-Complaints-To:1': 0.32; 'to:addr:python-list': 0.33; 'source': 0.34; 'skip:# 10': 0.34; 'header:User-Agent:1': 0.35; 'subject: ?': 0.35; 'using': 0.35; 'subject:skip:p 10': 0.37; 'skip:e 20': 0.37; 'received:org': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'more': 0.60; 'here:': 0.62; 'article': 0.76; 'advantages': 0.77 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ned Deily Subject: Re: pkg_resources ? Date: Tue, 14 Jun 2011 13:50:12 -0700 References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: baybryj.net User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308084642 news.xs4all.nl 49177 [::ffff:82.94.164.166]:40838 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7630 In article , km wrote: > I am trying to look at the source code of a python script (run.py). But > it reads > ###########code - run.py ######################## > #!/usr/bin/env python > # EASY-INSTALL-SCRIPT: 'pbpy==0.1','run.py' > __requires__ = 'pbpy==0.1' > import pkg_resources > pkg_resources.run_script('pbpy==0.1', 'run.py') > ##############code ##################### > > What are the advantages of using pkg_resources stuff ? What you are seeing is boiler-plate code automatically generated by setuptools (or the Distribute clone of setuptools) when a script is installed with easy_install. The main reason for the wrapper is to allow multiple versions of a Python "package" (in the PyPi sense) to be installed in one Python instance. There's more information here: http://peak.telecommunity.com/DevCenter/setuptools -- Ned Deily, nad@acm.org