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.4.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

injectme-0.0.4-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: injectme-0.0.4.tar.gz
  • Upload date:
  • Size: 4.0 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.4.tar.gz
Algorithm Hash digest
SHA256 1e4dbd88ff235afbb8031a9385d03eab5df2633526ee92d90bf2eb02f3a18832
MD5 1cf05473534b30dc94071094c0226e38
BLAKE2b-256 6274db8fa0401fe2caa5820f8117d85ccc727fe6f6b7245ce5f42a199d054d07

See more details on using hashes here.

File details

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

File metadata

  • Download URL: injectme-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.0 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fd99f0c5709a26de9026f5dba0ca7b6cd7631b6a6391b38abc999678df8bd973
MD5 4a8dbcc458206368a511d0932aeb7516
BLAKE2b-256 5da8fa5d92978167765174859ed5ea724a25bf45e91680dc94e2b04204c91668

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