Aglyph — Dependency Injection for Python¶
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¶
- What’s new in release 2.1.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
- aglyph — Dependency Injection for Python
- aglyph.assembler — The Aglyph component assembler
- aglyph.binder — The Aglyph component binder
- aglyph.cache — Simple object caching support for Aglyph
- aglyph.compat — Python version/variant compatibility
- aglyph.compat.ipyetree — an ElementTree parser for IronPython
- aglyph.component — Defining components and their dependencies
- aglyph.context — Defining component contexts
- aglyph.integration.cherrypy — Integrating Aglyph with CherryPy
- Aglyph 2.1.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 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.