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 details)
Built Distribution
simple_ioc-3.0-py3-none-any.whl
(14.9 kB
view details)
File details
Details for the file simple-ioc-3.0.tar.gz
.
File metadata
- Download URL: simple-ioc-3.0.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64a4afda1020d501fc8ec59a2d3d3f6a6a1cae16b9d76ac69cf5288c0f66ea62 |
|
MD5 | 1d177c30149758b3ccced3101fd40369 |
|
BLAKE2b-256 | d5996bf7da624eec70718d7a3b54606dd59f69a1d24b2bd05d7919e992c58371 |
File details
Details for the file simple_ioc-3.0-py3-none-any.whl
.
File metadata
- Download URL: simple_ioc-3.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd9d5295781210f7390c8a729ec480477238b6e0fb54cf0f0c74f863ca4f84ff |
|
MD5 | e79329b4cf4adbc3ed8672fd5f7f1d07 |
|
BLAKE2b-256 | 0c7e51934ffb497a521d32cb8527ca05a3b899d0711828310083cf8c8ab00fe7 |