A lightweight library with an implementation of IoC
Project description
# Simple IoC
[![Build Status](https://travis-ci.org/agroptima/simple-ioc.svg)](https://travis-ci.org/agroptima/simple-ioc)
[![License GPLv3](https://img.shields.io/badge/license-GPLv3-red.svg)](https://opensource.org/licenses/GPL-3.0)
![Python versions](https://img.shields.io/badge/python-3.x-blue.svg)
## 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:
```python
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`:
```python
a_service = Container().get('an_identifier')
```
[![Build Status](https://travis-ci.org/agroptima/simple-ioc.svg)](https://travis-ci.org/agroptima/simple-ioc)
[![License GPLv3](https://img.shields.io/badge/license-GPLv3-red.svg)](https://opensource.org/licenses/GPL-3.0)
![Python versions](https://img.shields.io/badge/python-3.x-blue.svg)
## 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:
```python
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`:
```python
a_service = Container().get('an_identifier')
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
simple-ioc-3.0.tar.gz
(2.1 kB
view hashes)
Built Distribution
simple_ioc-3.0-py3-none-any.whl
(14.9 kB
view hashes)