-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.txt
47 lines (32 loc) · 1.1 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
============================================
Python Simple Dependency Injection Container
============================================
This project is a simple port of the Symfony2 DependencyInjection lib available at https://github.com/symfony/DependencyInjection
Status: Work In Progress
Usage
-----
- Create a services.yml file, the file will contains different service definiton such as
.. code-block:: yaml
parameters:
foo.bar: argument 1
services:
fake:
class: tests.ioc.service.Fake
arguments:
- "%foo.bar%"
kargs:
param: here a parameter
calls:
- [ set_ok, [ false ]]
- [ set_ok, [ true ], {arg2: "arg"} ]
foo:
class: tests.ioc.service.Foo
arguments: ["@fake", "#@weak_reference"]
kargs: {}
weak_reference:
class: tests.ioc.service.WeakReference
Then to use and access a service just do
.. code-block:: python
import ioc
container = ioc.build(['services.yml'])
foo = container.get('foo')