Aglyph — Dependency Injection for Python¶
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 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¶
- What’s new in release 3.0.0?
- Getting started with Aglyph
- 1. Download and install Aglyph
- 2. Download, extract, and run the movielisterapp application
- 3. A (very) brief introduction to Dependency Injection
- 4. Make some general improvements to the movielisterapp application
- 5. Add Dependency Injection support to the movielisterapp application
- 6. Make changes to the movielisterapp application
- Suggested next steps
- Aglyph cookbook
- Aglyph API reference
- The Aglyph Context fluent API
- Aglyph 3.0.0 testing summary
- Roadmap for future releases
- 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 follows the Semantic Versioning (SemVer) guidelines.
The Aglyph version is always defined as the
__version__ member of the
>>> import aglyph >>> aglyph.__version__ '3.0.0'
Aglyph context DTD
includes the Aglyph version in the filename and in a header comment.