Pytidy
A type hint based dependency injection library for python language (+3.6). While there are already several DI libraries for python, this library is inspired by Java Spring and aims to provide similar interface and functionality to Java Spring.
Supports Python 3.7 and 3.8.
Usage
Super simple. Attach @component decorator to any classes which need to be injected in somewhere constructor, and attach @autowired decorator to constructors which need dependency injection.
from pytidy.decorators import component, autowired
@component
class Hello:
def say(self):
print("Hello")
class Injected:
@autowired
def __init__(self, instance: Hello):
self.instance = instance
def say_proxy(self):
self.instance.say()
a = Injected()
a.say_proxy()
Also supports dataclass of Python3.7+.
from dataclasses import dataclass
from pytidy.decorators import component, autowired_cls
@component
class Hello:
def say(self):
print("Hello")
@autowired_cls
@dataclass
class Injected:
instance: Hello
def say_proxy(self):
self.instance.say()
a = Injected()
a.say_proxy()
License
MIT
Metadata
Release files for pytidy 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytidy-0.4.0.tar.gz | 3.5 kB | Without provenance | Details for pytidy-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytidy-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for pytidy-0.4.0-py3-none-any.whl |
Total release size: 9.1 kB
Release files / pytidy-0.4.0.tar.gz
| Download URL | pytidy-0.4.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e2150addefa82c3f829681120dee2021bef3cca0b734d3ba7a53c9cf81b91d46
|
|
BLAKE2b-256 checksum How to use checksums |
e15dbe5a8aaa74ce845f0b4428fda7cace7a55be7c6a4ab0b3d492016a9f11b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.7
|
Release files / pytidy-0.4.0-py3-none-any.whl
| Download URL | pytidy-0.4.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1e870812f737720964e56852c4dab03b4887468cd19014bde0bffc38b5c56fd
|
|
BLAKE2b-256 checksum How to use checksums |
b460d97cd36dc686950dbce346ee86be797734ce3e2e7d6b53e5de30e12555a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.7
|
Security for pytidy 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.