Inject 3.3.0

This is a fast Python dependency injection tool
It uses descriptors and decorators to reference external dependencies, and scopes to specify how to reuse objects.

Dependencies can be referenced by types and optional annotations.

No configuration is required, but advanced in-code configuration is possible.

Most other python dependency injection tools, such as PyContainer or Spring Python, are ports from other languages (Java). So they are based on dependency injection ways specific for statically typed languages.

Python is not Java, and so patterns and programming techniques, which seem proper and usable in one language, can be awkward in another.

Inject has been created to provide a pythonic way of dependency injection, utilizing specific Python functionality.

Terminology used in inject has been intentionally made similar to Guice, however the internal architecture is different.

Main features:

  • Fast, only 2-3 times slower that direct instantiation.
  • Normal way of instantiating objects, Class(*args, **kwargs).
  • Injecting arguments into functions and methods.
  • Referencing dependencies by types and optional annotations.
  • Binding to callables, instances and unbound methods (see [nvokers).
  • Request scope middleware for WSGI and Django applications (requires Python2.5+).
  • No configuration required at all.
  • Advanced flexible configuration possible
  • Two injection methods, a descriptor and a decorator
  • Support for inheritance by passing inject.super as the default kwarg value
  • Invokers to call unbound methods (cool for listeners)
  • Partial injections, when only some arguments are injected:
  • Scopes: application (singleton), request, noscope
  • Easy integration into existing projects.

last updated on:
August 27th, 2014, 2:43 GMT
license type:

MIT License

developed by:
Ivan Korobkov
operating system(s):
Windows / Linux / Mac OS / BSD / Solaris
C: \ Programming Tools
Download Button

In a hurry? Add it to your Download Basket!

user rating



Rate it!
What's New in version 3.0.0
  • Removed intelliJ idea files.
read full changelog

Add your review!