Aglyph — Dependency Injection for Python

Release:2.1.0

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

Aglyph runs on CPython 2.7 and 3.1 - 3.4, and on recent versions of the PyPy, Jython, IronPython, and Stackless Python variants. See Aglyph 2.1.0 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), borg components (a new instance is created every time, but all instances of the same class share the same internal state), and weakref components (the same instance is returned as long as there is at least one “live” reference to that instance in the application).

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

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

Aglyph versioning

Aglyph follows the Semantic Versioning Specification (SemVer).

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

>>> import aglyph
>>> aglyph.__version__
'2.1.0'

The Aglyph context DTD includes the Aglyph version in the filename and in a header comment.

Indices and tables