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 details)
Built Distribution
File details
Details for the file pypotage-1.0.0a0.tar.gz
.
File metadata
- Download URL: pypotage-1.0.0a0.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bba512446f0106bedd7be573581e89e7e672dcc0f5c9740d1e6cc34b6a2e91a |
|
MD5 | 3e3b8aa8d148199e53c2ddb768d2b69a |
|
BLAKE2b-256 | f6c895dfb689bf26b4e43a48b763d52c5d23c9dabf0c1319baaf49b5e71e593a |
File details
Details for the file pypotage-1.0.0a0-py3-none-any.whl
.
File metadata
- Download URL: pypotage-1.0.0a0-py3-none-any.whl
- Upload date:
- Size: 9.7 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 | 29f6eaba915d7464189e338a2c8fb67d50e7f18b2f54376f599a88b7eba9df50 |
|
MD5 | 63e1f0b6662baf0ce8366f4846e4911b |
|
BLAKE2b-256 | eaeba3950bbd17ca41aebf88c02d67868a00e6a616000009a8657c889e896445 |