Aglyph — Dependency Injection for Python

Aglyph PyPI version Aglyph supported Python version Aglyph supported Python implementation Aglyph License Aglyph Wheel availability

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

Aglyph runs on CPython 2.7 and 3.4+, and on recent versions of the PyPy, Jython, IronPython, and Stackless Python variants. See Aglyph 3.0.0.post1 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 PEP 440 for versioning and maintains Semantic Versioning (SemVer) compatibility.

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

>>> import aglyph
>>> aglyph.__version__

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

Indices and tables