Injectable is an elegant and simple Dependency Injection framework built with Heart and designed for Humans.
Project description
Usage Examples 🚩 | Developer Reference 👩💻 | Authors 👫
license |
|
---|---|
docs |
|
tests |
|
package |
Injectable is an elegant and simple Dependency Injection framework built with Heart and designed for Humans.
|
|
Features you’ll love ❤️
Autowiring: injection is transparent to the function. Just decorate the function with
@autowired
and annotate parameters withAutowired
, that’s it.Automatic dependency discovery: just call
load_injection_container()
at the root of your project or pass the root path as an argument. All classes decorated with@injectable
will be automatically discovered and ready for injection.Qualifier overloading: declare as many injectables as you like for a single qualifier or extending the same base class. You can inject all of them just by specifying a
typing.List
toAutowired
:deps: Annotated[List["qualifier"], Autowired]
.Transparent lazy initialization: passing the argument
lazy=True
forAutowired
will make your dependency to be initialized only when actually used, all in a transparent fashion.Singletons: decorate your class with
@injectable(singleton=True)
and only a single instance will be initialized and shared for injection.Namespaces: specify different namespaces for injectables as in
@injectable(namespace="foo")
and then just use them when annotating your parameters as indep: Annotated[..., Autowired(namespace="foo")]
.Linters friendly:
Autowired
is carefully designed to comply with static linter analysis such as PyCharm’s to preserve the parameter original type hint.
These are just a few cool and carefully built features for you. Check out our docs!
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
Built Distribution
File details
Details for the file injectable-4.0.1.tar.gz
.
File metadata
- Download URL: injectable-4.0.1.tar.gz
- Upload date:
- Size: 31.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f5b269d5560a8c34d1d7fdc5064acbb96e3a11ee79fe3cc7ea98dbfa35309dc |
|
MD5 | dc44b55433c576e7670c0a46426abcb6 |
|
BLAKE2b-256 | 2c8b53e3ff8255d4dc8efa7db135e51152575247cb3f54e8e38aaeba38621eec |
File details
Details for the file injectable-4.0.1-py3-none-any.whl
.
File metadata
- Download URL: injectable-4.0.1-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42f5879b78383c22127510ab7ff468651cae1f4cee1fae64aadccb1793658bec |
|
MD5 | 2e18d2baf2f2dc455ca47e0b2fc3f11b |
|
BLAKE2b-256 | afb571150cbc179fcc2ca4e1bfcfd5ce583c9e3f27a2db1cc1a423484cb4c0bc |