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-2.0.0a0.tar.gz
(11.2 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
File details
Details for the file pypotage-2.0.0a0.tar.gz.
File metadata
- Download URL: pypotage-2.0.0a0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee09cb4e3180326abaa2b3366b836ea21c36313bcb1e4efc2e98b7016cd79ac1
|
|
| MD5 |
70278d537b3d86034087bcaa8d5285f5
|
|
| BLAKE2b-256 |
056261c3be1eb57b4f795a33759d956dcbde20f073681012f7db0278c00bb048
|
File details
Details for the file pypotage-2.0.0a0-py3-none-any.whl.
File metadata
- Download URL: pypotage-2.0.0a0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fd8d708cf17b73956f1f7c36703df052ebfad68616b85b5e70fa414ab400414
|
|
| MD5 |
e698e0750e8b895057437e00b49a55ad
|
|
| BLAKE2b-256 |
1bed29412008f23f2c47ea70e310a8fbc5fa670b8d3263521b2f969383733d13
|