Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Python module which provides decorators to make dependency injection easy to use.

Project Description

Dependency injection framework for Python

DI_ENABLE - module variable to enable/disable
the whole DI mechanism (default: True)
@inject - decorator for classes, function or methods

that prepares the injections and executes then when the decorated function or method is called.

When used on a class it only prepares the structures and instance methods that use DI must be decorated by @usesclassinject

@usesclassinject - this marks an instance method which
should use DI prepared by @inject on a class level

Known issues and limitations:

  • it is not able to redefine a variable name which is also provided by closure (closure one has priority)
  • decorated class shares it’s DI dictionary between all it’s instances
Release History

Release History

This version
History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
di-0.3.tar.gz (10.9 kB) Copy SHA256 Checksum SHA256 Source Aug 21, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting