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!

Pythonic dependency injection container

Project Description
# pySyringe

[![Build Status](](
[![Coverage Status](](

This is `pySyringe`. Inversion of Control container, which helps you get proper [`Dependency Injection`](, while still being Pythonic.

Currently `pySyringe` works only on Python 3.3+. Maybe later, support for older versions will be added.

## Installation

pip install pysyringe

## Usage

>>> import pysyringe
>>> class Foo:
... def __init__(self):
... = 42
>>> @pysyringe.inject(foo=Foo)
... def important_function(foo):
... return
>>> important_function()

>>> class Mock:
... def __init__(self):
... = 1
>>> important_function(Mock())
>>> @pysyringe.inject_value(foo=42)
... def important_function2(foo):
... return foo
>>> important_function2()


As you can see testing is **a lot** simpler now. You don't need as much _(hopefully none)_ mocking as you used to.

If `pySyringe` injects the same class twice, it doesn't create instances twice, it simply returns previous one.

## Testing

1. Clone this repository
2. Run `python develop`
3. Install `pytest` from `pip`
4. Run `py.test`
Release History

Release History

This version
History Node


History Node


History Node


History Node


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
pySyringe-1.2.0.tar.gz (2.1 kB) Copy SHA256 Checksum SHA256 Source Dec 16, 2015

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