Skip to content

agroptima/simple-ioc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple IoC

Build Status License GPLv3 Python versions

Install

$ pipenv install simple-ioc

or

$ pip install simple-ioc

Usage

In order to have the IoC (Inversion of Control) working in your application, you must register your services in the IoC container:

from simple_ioc import Container

class AService:
    # Your service implementation comes here

Container().register('an_identifier', lambda: AService())

Then, from any point in your application, you can retrieve the service by calling get:

a_service = Container().get('an_identifier')