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.0.1a0.tar.gz
(16.5 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.0.1a0.tar.gz.
File metadata
- Download URL: pypotage-2.0.0.1a0.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
213b6be8b953fa82ceacc507031bcd524e7de420175b6e6e17b09ec4f8c82c1d
|
|
| MD5 |
3c73465842a1595553bb08353d40fbcc
|
|
| BLAKE2b-256 |
670fd7cfe7524a15c6e6ddf47f8d49f1651828bf872b0b66c4a09619516c39be
|
File details
Details for the file pypotage-2.0.0.1a0-py3-none-any.whl.
File metadata
- Download URL: pypotage-2.0.0.1a0-py3-none-any.whl
- Upload date:
- Size: 21.9 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 |
96baff43b0de78926fc0eeabc1c8df951cf641beff92a6a848cdd29c8b2d9524
|
|
| MD5 |
a103961faee769a65af19a74b14d2b1b
|
|
| BLAKE2b-256 |
c1a045e4771b196271494842ccbf2d2e03087c3d78a218d46a95c3d3e9edcd5b
|