ResourcePackage 1.0.0a2 available...

Mike C. Fletcher mcfletch at rogers.com
Mon Jan 13 11:45:24 EST 2003


ResourcePackage is a mechanism for automatically managing resources 
(i.e. non-Python files: small images, documentation files, binary data) 
embedded in Python modules (as Python source code), particularly for 
those wishing to create re-usable Python packages which require their 
own resource-sets.

ResourcePackage allows you to set up resource-specific sub-packages 
within your package.  It creates a Python module for each resource 
placed in the resource package's directory during development.  You can 
set up these packages with a simple file-copy and then use the resources 
saved/updated in the package directory like so:

    from mypackage.resources import open_icon
    result = myStringLoadingFunction( open_icon.data )

ResourcePackage scans the package-directory on import to refresh module 
contents, so simply saving an updated version of the file will make it 
available the next time your application is run.

When you are ready to distribute your package, you need only replace the 
copied file with a dummy __init__.py to disable the scanning support and 
eliminate all dependencies on resourcepackage (that is, your users do 
not need to have resourcepackage installed once this is done).  Users of 
your packages do not need to do anything special when creating their 
applications to give you access to your resources, as they are simply 
Python packages/modules included in your package's hierarchy.  Your 
package's code (other than the mentioned __init__.py) doesn't change.

Note: there is code in resource package to allow you to manually refresh 
your package directories w/out copying in __init__.py.  I haven't yet 
wrapped that as a script, but intend to for the 1.0 release. 
 ResourcePackage is currently in 1.0 alpha status, it appears to work 
properly, but it has only had minimal testing.  You can get the 
distribution from the project page at:

    http://sourceforge.net/projects/resourcepackage/

I'm interested in any bug reports, enhancement requests or comments.

Enjoy all,
Mike Fletcher

_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/








More information about the Python-list mailing list