skip to navigation
skip to content

Not Logged In

autoinstall 0.2

package loader for auto installing Python packages.

package loader for auto installing Python packages.

A package loader in the spirit of Zero Install that can be used to
inject dependencies into the import process.


To install::

    easy_install -U autoinstall

      or

    download, unpack, python setup.py install

      or

    try the bootstrap loader. See below.


To use::

    # You can bind any package name to a URL pointing to something
    # that can be imported using the zipimporter.

    autoinstall.bind("pymarc", "http://pypi.python.org/packages/2.5/p/pymarc/pymarc-2.1-py2.5.egg")

    import pymarc

    print pymarc.__version__, pymarc.__file__


Changelog::

- added support for non top level packages.
- cache files now use filename part from URL.
- applied patch from Eric Seidel  to add support
for loading modules where the module is not at the root of the .zip
file.


TODO::

- a description of the intended use case
- address other issues pointed out in:

    http://mail.python.org/pipermail/python-dev/2008-March/077926.html

Scribbles::

pull vs. push
user vs. system
web vs. filesystem
auto vs. manual

manage development sandboxes

optional interfaces...

    def get_data(pathname) -> string with file data.

    Return the data associated with 'pathname'. Raise IOError if
    the file wasn't found.");

    def is_package,
    "is_package(fullname) -> bool.

    Return True if the module specified by fullname is a package.
    Raise ZipImportError is the module couldn't be found.");

    def get_code,
    "get_code(fullname) -> code object.

    Return the code object for the specified module. Raise ZipImportError
    is the module couldn't be found.");

    def get_source,
    "get_source(fullname) -> source string.

    Return the source code for the specified module. Raise ZipImportError
    is the module couldn't be found, return None if the archive does
    contain the module, but has no source for it.");


Autoinstall can also be bootstraped with the nascent package loader
bootstrap module. For example::

    #  or via the bootstrap
    # loader.

    try:
        _version = "0.2"
        import autoinstall
        if autoinstall.__version__ != _version:
            raise ImportError("A different version than expected found.")
    except ImportError, e:
        # http://svn.python.org/projects/sandbox/trunk/bootstrap/bootstrap.py
        import bootstrap
        pypi = "http://pypi.python.org"
        dir = "packages/source/a/autoinstall"
        url = "%s/%s/autoinstall-%s.tar.gz" % (pypi, dir, _version)
        bootstrap.main((url,))
        import autoinstall

References::

  http://0install.net/
  http://www.python.org/dev/peps/pep-0302/
  http://svn.python.org/projects/sandbox/trunk/import_in_py
  http://0install.net/injector-find.html
  http://roscidus.com/desktop/node/903
 
File Type Py Version Uploaded on Size
autoinstall-0.2.tar.gz (md5) Source 2009-12-22 4KB
  • Downloads (All Versions):
  • 64 downloads in the last day
  • 315 downloads in the last week
  • 977 downloads in the last month
  • Author: Daniel Krech
  • Home Page: http://pypi.python.org/pypi/autoinstall/
  • License:
    Copyright (c) 2009, Daniel Krech
    All rights reserved.
    
    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
    
      * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    
      * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
    
      * Neither the name of the Daniel Krech nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
    
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  • Package Index Owner: eikeon
  • DOAP record: autoinstall-0.2.xml