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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file injectme-0.0.6.tar.gz.

File metadata

  • Download URL: injectme-0.0.6.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.2

File hashes

Hashes for injectme-0.0.6.tar.gz
Algorithm Hash digest
SHA256 daa08401663cef69d50b82c5fef495c023e32630a901238297f6c0bfa380ffb8
MD5 a38e99b2b199510da2e817f94b7c245b
BLAKE2b-256 a140303657cfb678acb8dbfb91ab06b914819cd1e1767ee1fafa67199fe448bc

See more details on using hashes here.

File details

Details for the file injectme-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: injectme-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.2

File hashes

Hashes for injectme-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c2365ba8b3931cfc3caa094b6d6c8fcf948d96b2bf5d89f28463fe71ffd42c4c
MD5 6b27fdac58c932a4fa65261144b40326
BLAKE2b-256 e5bcb873eac4f65b23b07ce59211a5781be1b40a86c8b211e613928c83e2c475

See more details on using hashes here.

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