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


Groups > comp.lang.python > #7630

Re: pkg_resources ?

From Ned Deily <nad@acm.org>
Subject Re: pkg_resources ?
Date 2011-06-14 13:50 -0700
References <BANLkTi=-=jjLK_4awQgNA3H7kv3AA9Y5tw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.232.1308084641.11593.python-list@python.org> (permalink)

Show all headers | View raw


In article <BANLkTi=-=jjLK_4awQgNA3H7kv3AA9Y5tw@mail.gmail.com>,
 km <srikrishnamohan@gmail.com> 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

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


Thread

Re: pkg_resources ? Ned Deily <nad@acm.org> - 2011-06-14 13:50 -0700

csiph-web