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

Uploaded Source

Built Distribution

injectme-0.0.5-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: injectme-0.0.5.tar.gz
  • Upload date:
  • Size: 4.9 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.5.tar.gz
Algorithm Hash digest
SHA256 b6eff3a74ecb96c14e4809174b46f08b0436173934402fc09543d7440685ab6a
MD5 41dd0cb74418dc5bcc13a074159fad46
BLAKE2b-256 97960cc5a510d56d50864657c023615c587d43c4a65775201674b0614f40e1c4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: injectme-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ef861a6a5365407ea03116377230b1d716e8d0a10a68f735169e43a60a9b0b4e
MD5 ac22348b71a458239c7d8619df877a3f
BLAKE2b-256 3c530bfff4a39e811996f9f7c09708d5de8d37b3707d3d19e62b48fa453954b3

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