Changes between Initial Version and Version 1 of PythonEggs/PluginDirs


Ignore:
Timestamp:
09/05/08 14:52:02 (13 years ago)
Author:
spascoe
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PythonEggs/PluginDirs

    v1 v1  
     1When deploying services as eggs we have found we often want to configure which eggs are visible to a 
     2python process.  Sometimes different services running on the same machine require different versions of an egg.  An elegant way to manage this is to not install a project's eggs with {{{easy_install}} at all but to use a plugin directory instead. 
     3 
     4For instance, say you have a pylons application that needs {{{ows-common 0.1.1dev-r3812}}}.  This is a very raw version of ows-common so we don't even want to install it in multi-version mode with {{{easy_install -m}}}.  Instead we put the egg in a subdirectory of the pylons app's deployment directory. 
     5 
     6{{{ 
     7 + app_deployment 
     8 | 
     9 \-+ eggs 
     10 | | 
     11 | \ ows_common-0.1.1dev_r3812-py2.5.egg 
     12 | 
     13 \ development.ini 
     14 
     15}}} 
     16 
     17Provided ows_common is not installed system-wide (or is installed in multi-version mode) the following script will load the any eggs in the {{{app_deployment/eggs}}} directory before running paster: 
     18 
     19{{{ 
     20#!python 
     21from pkg_resources import * 
     22dists, errors = working_set.find_plugins(Environment(['./eggs'])) 
     23 
     24for dist in dists: 
     25    print 'Adding %s to working_set' % dist 
     26    working_set.add(dist) 
     27if errors: 
     28    print "WARNING: Couldn't load", errors 
     29 
     30load_entry_point('PasteScript', 'console_scripts', 'paster')() 
     31}}} 
     32 
     33See [http://proj.badc.rl.ac.uk/dcip/changeset/974: DCIP Trac changeset:974] for an example of using this on the DDP WMS. 
     34 
     35In the future we hope to have a command-line tool for doing this sort of thing.