Skip to main content

Overview

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.

Metadata

Release files for smart-injector 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smart-injector 0.0.6
File Size Uploaded
smart-injector-0.0.6.tar.gz 36.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smart-injector 0.0.6
File Interpreter ABI Platform
smart_injector-0.0.6-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 60.2 kB

Release files / smart-injector-0.0.6.tar.gz

Download URL smart-injector-0.0.6.tar.gz
Size 36.7 kB
Tags Source
SHA-256 checksum
How to use checksums
93c7cf2238c67fb0e7d52dc921e9f44997300d9c81b26ffeb5612064e6997e80
BLAKE2b-256 checksum
How to use checksums
01315084f77e5536318d0814bc0aae3201b6fbb8810e0c33c8129a789854f01d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / smart_injector-0.0.6-py2.py3-none-any.whl

Download URL smart_injector-0.0.6-py2.py3-none-any.whl
Size 23.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b0c03573dc85a843480e513e4c85716260976f5f1f4b34c203dcd1c715cfdaf4
BLAKE2b-256 checksum
How to use checksums
b7e279de2c9a152d1aa9189dbb5ae999dc17eee6bd854d9ef6de70efab105a94
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page