A lightweight library with an implementation of IoC
Project description
# Simple IoC
## 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(object):
# 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')
```
## 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(object):
# 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-1.0.tar.gz
(1.9 kB
view hashes)