Skip to main content

No project description provided

Project description

# dependency injection

A dependency injection framework for python.

Just like `Microsoft.Extensions.DependencyInjection`.

## Usage

``` py
class A:

class B:
def __init__(self, a: A):
assert isinstance(a, A)

import dependencyinjection as di

service = di.Services()
provider =
assert isinstance(provider.get(A), A)
assert isinstance(provider.get(B), B)

with provider.scope() as scoped_provider:
assert provider.get(A) is provider.get(A)
assert scoped_provider.get(B) is scoped_provider.get(B)
assert provider.get(B) is scoped_provider.get(B)
assert not (provider.get(A) is scoped_provider.get(A))

Project details

Download files

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

Files for dependencyinjection, version
Filename, size File type Python version Upload date Hashes
Filename, size dependencyinjection- (29.5 kB) File type Egg Python version 3.6 Upload date Hashes View
Filename, size dependencyinjection- (6.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page