Skip to content

omauger/dependencies_injection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dependencies Injection

This package permit to implement easily dependencies injection in python projects.

You have to define in your project di.py file which describe the DEPENDENCIES binding.

di.py example :

def injected_class():
	from module_to_inject import  ClassToInject
	return ClassToInject

DEPENDENCIES = {
	"injected_class": injected_class, 
}

To use the injection in your code, import inject_param decorator and add decorator with string for injected param binding. Example :

from dependencies_injection.inject_param import inject_param

class A:

	@inject_param("injected_class")
	def func_to_do_something(injected_class=None):
		return injected_class.__class__.__name__

You can also inject function or value with the same way.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages