Dependency injection with type hints
Project description
Wint - dependency injection with type hints.
Intro
Wint is a lightweight library that implements dependency injection via type hinting.
This project is in development.
Documentation will come up later.
Examples
from wint import autowired, container
class Printer:
def print(self, message):
raise NotImplementedError
class RealPrinter(Printer):
def print(self, message):
print(message)
@autowired()
class PrintService:
printer: Printer # RealPrinter will be automatically injected as instance property
def run(self, msg):
self.printer.print(f"{msg}, i'm printing!")
if __name__ == "__main__":
container.register(Printer, RealPrinter()) # register Printer implementation as singleton.
PrintService().run('hey')
>>> hey, i'm printing!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wint-0.1.0.tar.gz
(5.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
wint-0.1.0-py3-none-any.whl
(23.4 kB
view details)
File details
Details for the file wint-0.1.0.tar.gz.
File metadata
- Download URL: wint-0.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d66fd301b0175e8df43c5eccc21c7082fea24195e978dda332cda2ea9cefd94
|
|
| MD5 |
4dea8428f22868d3660f256676f4c84c
|
|
| BLAKE2b-256 |
77dea2b22aa12e45af093ebda55ebe153e5d894a66633e1beee0aeb74bc85916
|
File details
Details for the file wint-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wint-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee04f2196659226e53e35f56f55250c8802edee23590081fcbdef8d0abd13348
|
|
| MD5 |
0e914d873949b38a9d27cba2958251b6
|
|
| BLAKE2b-256 |
123ea884d1ccc534277ab53ea0de4bce3508e5f40ff7d192f97fd0c4b8608cf4
|