Skip to main content

package loader for auto installing Python packages.

Project description

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. Autoinstall can be
bootstraped with the nascent package loader bootstrap module. For
example::

try:
_version = "0.1a"
import autoinstall
if autoinstall.__version__ != _version:
raise ImportError("A different version than exprected 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

# once imported you can bind any top level 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__


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

TODO::

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.");

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autoinstall-0.1a.tar.gz (2.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page