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:
pass

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

import dependencyinjection as di

service = di.Services()
service.scoped(A)
service.singleton(B)
provider = service.build()
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.

Source Distribution

dependencyinjection-0.1.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

dependencyinjection-0.1.1.0-py3.6.egg (25.0 kB view details)

Uploaded Source

File details

Details for the file dependencyinjection-0.1.1.0.tar.gz.

File metadata

File hashes

Hashes for dependencyinjection-0.1.1.0.tar.gz
Algorithm Hash digest
SHA256 97eb92c0cff5e31b727ec38de40e25c1214a2d5228ab05e899d37cb2d1da4a81
MD5 30608b95b8ef562d5b2262f065474144
BLAKE2b-256 e18c8aad562839b2d9afa37905c3502dfbed8ed9443cbf38000eb6e449348779

See more details on using hashes here.

File details

Details for the file dependencyinjection-0.1.1.0-py3.6.egg.

File metadata

File hashes

Hashes for dependencyinjection-0.1.1.0-py3.6.egg
Algorithm Hash digest
SHA256 7d91d2de45e7dd03f860dba38d021ecd95a8459bd3aa224fb0a91f96486366f8
MD5 99f55007f95bbde4f04f2cda802acb1b
BLAKE2b-256 731530dd97ede2cde65f5078a79f8c865ae70495ebd4df5bf42c0f3017118be5

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