Metadata-Version: 1.0
Name: pydi
Version: 0.3.1
Summary: Little Dependency Injection Container
Home-page: http://github.com/aventurella/pydi
Author: Adam Venturella
Author-email: aventurella@gmail.com
License: Copyright (c) 2012 Adam Venturella.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Description: # Simple Little Dependency Injection Container
        
        [![Build Status](https://secure.travis-ci.org/aventurella/pydi.png?branch=master)](http://travis-ci.org/aventurella/pydi)
        
        ## Usage:
        
        ```python
            from pydi import Container
        
            class DogService(object):
                def __init__(self, dep):
                    self.dep = dep
        
                def action(self):
                    self.dep.action()
        
            class FooService(object):
        
                def __init__(self, dep1, dep2):
                    self.dep1 = dep1
                    self.dep2 = dep2
        
                def action1(self):
                    self.dep1.action()
        
                def action2(self):
                    self.dep2.action()
        
            class Bar(object):
        
                def action(self):
                    print('bar')
        
            class Baz(object):
        
                def __init__(self, option):
                    self.option = option
        
                def action(self):
                    print('baz!!!', self.option)
        
            class Lucy(object):
        
                def action(self):
                    print("I'm a dog!")
        
        
            container = Container()
        
            # shared must be called last. It will reuse an instance
            container.register(FooService).depends(Bar).depends(Baz, option="Hello World!").shared()
        
            # without shared, a new instance will be created each time
            container.register(DogService).depends(Lucy)
        
            # could also container['FoOSeRViCE']()
            obj = container.FooService()
            obj.action1()
            obj.action2()
        
            print('+-------------+')
        
            # could also container['fooservice']()
            obj2 = container.FooService()
            obj2.action1()
        
        
            print('+-------------+')
        
            obj3 = container.FooService()
            obj3.action1()
        ```
        
        
        
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: ISC License (ISCL)
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
