Simple and flexible dependency injection framework.
Project description
Gimme That
A lightweight, simple but extensible dependency injection framework. Read the full documentation here
Getting started
Install from PyPI
pip install gimme-that
Basic usage
import gimme
class MyService:
pass
class ServiceConsumer:
def __init__(self, service: MyService):
self.service = service
# gimme.that automatically detects and resolves dependencies based on type annotations
consumer = gimme.that(ServiceConsumer)
isinstance(consumer.service, MyService) # True
Features
Automatically detects dependencies based on type annotations
Works with dataclass classes and attr.s
Class repository that stores created objects for re-use
Register classes to provide additional configuration on how gimme.that should instantiate classes
Custom factory functions
Store or do not store created objects
Provide additional keyword arguments to the initializer
Scoped repositories to manage the lifetime of created objects (useful for testing)
Does not require any decorators or other additions to your classes (most of the time). They remain your classes
Detects circular dependencies, and provides the means to resolve them
Extensibility using plugins: create your own logic for resolving dependencies and instantiating classes
Development
pip install -e .[dev]
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 gimme-that-0.3.1.tar.gz
.
File metadata
- Download URL: gimme-that-0.3.1.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 143d4551c65f625abbb9c55995a521fec68d6a34b561516919e293c8c40d72f1 |
|
MD5 | 12dfc9691544266b44072cf57e720561 |
|
BLAKE2b-256 | 27c273fdf90901ba4fb5f042a200e730ae094f48ca982240149b0fc8559afe45 |
File details
Details for the file gimme_that-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: gimme_that-0.3.1-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3abf4ac9cf145714b25363aa3b387af696f771951cdbefd4f86953a4c5d38ff4 |
|
MD5 | 19f8fce9ff84710d03efcdb09807a58a |
|
BLAKE2b-256 | b9648430fc6d24fde977268fa63f5cad139a0facbb435d75fba961470fd3d6f9 |