Aglyph — Dependency Injection for Python — Aglyph 3.0.0 documentation

# Aglyph — Dependency Injection for Python

Release: | 3.0.0

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?
  - Previous releases of Aglyph
- 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
  - Understand the general features of Aglyph
  - Choose a configuration approach for Aglyph
  - Common usage scenarios
  - Component inheritance using templates
  - Other notable usage scenarios
  - Integrating Aglyph
- Aglyph API reference
  - `aglyph` — Dependency Injection for Python
  - `aglyph.assembler` — The Aglyph component assembler
  - `aglyph.component` — Defining components and their dependencies
  - `aglyph.context` — Defining component contexts
  - `aglyph.integration.cherrypy` — Integrating Aglyph with CherryPy
- The Aglyph Context fluent API
  - Introduction to the Context fluent API
  - Using component references with the Context fluent API
  - Using the Context fluent API to define templates
  - Letting Aglyph introspect dotted names
  - Overview of the Context fluent API methods
- Aglyph 3.0.0 testing summary
  - CPython
  - PyPy
  - Stackless Python
  - Jython
  - IronPython
  - Previous releases of Aglyph
- Roadmap for future releases

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 (SemVer) guidelines.

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

    >>> import aglyph
    >>> aglyph.__version__
    '3.0.0'

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

## Indices and tables

- Index
- Module Index
- Search Page