Skip to main content

Small DI library

Project description

injectme

Simple Dependency Injection library in pure Python.

If you have never heard about DI it's probably useless.

If you are struggling to tame all of your dependencies running wildly through your code and have a hard time passing high-level dependencies down the abstracion layers you might have found a solution.

It's small. It's simple. Does not enforce complex abstractions. Does not pollute the code.

Installation

This project is available as python package:

pip install injectme

Simple Example

from injectme import inject, register


class Dependency:
    def do_stuff(self):
        print("I'm useful")


@inject
class App:
    dependency: Dependency

    def run(self):
        self.dependency.do_stuff()


register(Dependency, Dependency())

app = App()
app.run()
I'm useful

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

injectme-0.0.6.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

injectme-0.0.6-py3-none-any.whl (6.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page