https://github.com/pavalso/potage
A simple Python package that provides an easy way to use Dependency Injection in your projects.
https://github.com/pavalso/potage
beans dependency-injection dependency-injection-container dependency-injection-framework design-patterns development factory ioc ioc-container potage python python-3 python3 utility
Last synced: 4 months ago
JSON representation
A simple Python package that provides an easy way to use Dependency Injection in your projects.
- Host: GitHub
- URL: https://github.com/pavalso/potage
- Owner: pavalso
- License: mit
- Created: 2024-03-25T20:00:06.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-09T20:45:14.000Z (over 1 year ago)
- Last Synced: 2025-09-01T17:23:33.790Z (9 months ago)
- Topics: beans, dependency-injection, dependency-injection-container, dependency-injection-framework, design-patterns, development, factory, ioc, ioc-container, potage, python, python-3, python3, utility
- Language: Python
- Homepage: https://pypotage.readthedocs.io
- Size: 198 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pypotage
[](https://pypi.org/project/pypotage/)
[](https://pypi.org/project/pypotage/)

[](https://codecov.io/github/pavalso/potage)
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:
````bash
python -m pip install -U pypotage
````
#### Development
To install the development version:
````bash
git clone https://github.com/pavalso/potage.git
cd potage
python -m pip install -U .
````
## Quick Examples
#### Basic usage
````python
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
````python
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
````