Skip to content

Tiny module-service and dependency injection framework

License

Notifications You must be signed in to change notification settings

13g10n/symbiont

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Symbiont

GitHub PyPI PyPI - Python Version PyPI - Downloads Lint & Test Codecov Code style: black

Tiny module-service and dependency injection framework

Installation

pip install symbiont

Usage

from symbiont import Module, Injectable, DependencyInjector


class BarService(Injectable):
    x: int = 42


class FooService(Injectable):
    bar: BarService


class ExampleModule(
    Module,
    providers=[BarService, FooService]
):
    foo: FooService


class RootModule(
    Module,
    imports=[ExampleModule]
):
    foo: FooService


injector = DependencyInjector()
root = injector.initialize(RootModule)


@injector.inject
def example_method(a, foo: FooService):
    ...

About

Tiny module-service and dependency injection framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages