A simple Python package that provides an easy way to use Dependency Injection in your projects.
Project description
pypotage
A simple Python package that provides an easy way to use Dependency Injection in your projects.
Key Features
- Easy to use
- Supports both function and class-based dependency injection
- Allows customizing the way dependencies are resolved
- Allows for the use of custom containers
Installing
To install the latest pypotage version, run the following command:
python -m pip install -U pypotage
Development
To install the development version:
git clone https://github.com/pavalso/potage.git
cd potage
python -m pip install -U .
Quick Examples
Basic usage
import pypotage
import logging
@pypotage.prepare
def logger():
logging.basicConfig(level=logging.DEBUG)
return logging.getLogger(__name__)
pypotage.cook(logging.Logger).take_out().info("Hello World!")
Using classes
import pypotage
class A:
def __init__(self):
...
@pypotage.prepare
class B(A):
def __init__(self):
...
pypotage.cook(A).take_out() # returns an instance of B
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
pypotage-1.0.0a0.tar.gz
(12.1 kB
view hashes)
Built Distribution
Close
Hashes for pypotage-1.0.0a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29f6eaba915d7464189e338a2c8fb67d50e7f18b2f54376f599a88b7eba9df50 |
|
MD5 | 63e1f0b6662baf0ce8366f4846e4911b |
|
BLAKE2b-256 | eaeba3950bbd17ca41aebf88c02d67868a00e6a616000009a8657c889e896445 |