Aglyph — Dependency Injection for Python

Release:1.1.0

Aglyph is a Dependency Injection framework for Python 2.5+, supporting type 2 (setter) and type 3 (constructor) injection.

Aglyph runs on CPython 2.5, 2.6, 2.7, 3.0, 3.1, and 3.2; and on recent versions of the PyPy, Jython, IronPython, and Stackless Python variants. See Aglyph testing summary for a complete list of the Python versions and variants on which Aglyph has been tested.

Aglyph can assemble prototype components (a new instance is created every time), singleton components (the same instance is returned every time), and borg components (a new instance is created every time, but all instances of the same class share the same internal state).

Aglyph can be configured using a declarative XML syntax, or programmatically in pure Python.

Aglyph is not a “full stack;” only dependency injection support is provided.

Table of Contents

See also

Inversion of Control Containers and the Dependency Injection pattern
The definitive introduction to Dependency Injection
Python Dependency Injection [PDF]
Alex Martelli’s introduction to Dependency Injection (and alternatives) in Python

Download

Download the latest distutils source or built distribution of Aglyph on SourceForge.

Clone the Aglyph Mercurial repository from BitBucket.

See Aglyph testing summary for a complete list of the Python versions and variants on which Aglyph has been tested.

Aglyph versioning

The Aglyph version is always defined as the __version__ member of the aglyph/__init__.py module:

>>> import aglyph
>>> aglyph.__version__
'1.1.0'

The Aglyph context DTD includes the version in the filename and in a header comment. This version represents the most recent Aglyph version in which the DTD itself was changed.

Aglyph increments its MAJOR.MINOR.MICRO version (i.e. aglyph.__version__) as follows:

  • A transparent (non-public) API change increments the MICRO version.
  • A backwards-compatible public API change increments the MINOR version.
  • Any non-backwards-compatible API change increments the MAJOR version.

As a result of this approach:

  • You can always upgrade/downgrade to a higher/lower MICRO version, assuming MAJOR and MINOR are the same.
  • You can always upgrade to a higher MINOR version, assuming MAJOR is the same.
  • Downgrading to a lower MINOR version (assuming MAJOR is the same) may require application and/or configuration changes (for example, if you took advantage of a new feature that is not available in the lower version).
  • Upgrading/downgrading to a higher/lower MAJOR version will always require application and/or configuration changes.

Indices and tables

Table Of Contents

Next topic

Getting started with Aglyph

This Page