Skip to main content

An easy to use lightweight dependency injection framework

Project description

Smart-injector is an lightweight dependency injection framework for Python. It was designed to be an easy to use tool to implement dependency injection in your application in a pythonic way.

Key features are: - Ligtweight - pure python - leverages type annotations - scopes - non invasive

Project Status

Installation

pip install smart-injector

You can also install the in-development version with:

pip install https://github.com/hlevering/python-smart-injector/archive/master.zip

Quickstart

Basic Usage:

>>> class A:
...     pass
...
>>> class B:
...     def __init__(self, a: A):
...         self.a = a
...
>>> container = create_container(StaticContainer)
>>> b = container.get(B)
>>> isinstance(b.a, A)
True

Documentation

Detailed documentation can be found here:

https://python-smart-injector.readthedocs.io/

Further usage examples can be found here: https://python-smart-injector.readthedocs.io/en/latest/usage.html

Development

To run the all tests run:

tox

Note, to combine the coverage data from all the tox environments run:

Windows

set PYTEST_ADDOPTS=--cov-append
tox

Other

PYTEST_ADDOPTS=--cov-append tox

Changelog

0.0.0 (2019-11-20)

  • First release on PyPI.

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

smart-injector-0.0.6.tar.gz (36.7 kB view details)

Uploaded Source

Built Distribution

smart_injector-0.0.6-py2.py3-none-any.whl (23.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file smart-injector-0.0.6.tar.gz.

File metadata

  • Download URL: smart-injector-0.0.6.tar.gz
  • Upload date:
  • Size: 36.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4

File hashes

Hashes for smart-injector-0.0.6.tar.gz
Algorithm Hash digest
SHA256 93c7cf2238c67fb0e7d52dc921e9f44997300d9c81b26ffeb5612064e6997e80
MD5 9cf913b92df9338dbe35d28dd521409b
BLAKE2b-256 01315084f77e5536318d0814bc0aae3201b6fbb8810e0c33c8129a789854f01d

See more details on using hashes here.

File details

Details for the file smart_injector-0.0.6-py2.py3-none-any.whl.

File metadata

  • Download URL: smart_injector-0.0.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4

File hashes

Hashes for smart_injector-0.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b0c03573dc85a843480e513e4c85716260976f5f1f4b34c203dcd1c715cfdaf4
MD5 124f3ed69448c1b02ba5759fa7ce7579
BLAKE2b-256 b7e279de2c9a152d1aa9189dbb5ae999dc17eee6bd854d9ef6de70efab105a94

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