Skip to main content

A simple Python package that provides an easy way to use Dependency Injection in your projects.

Project description

pypotage

img img python-package-yml codecov

A simple Python package that provides an easy way to use Dependency Injection in your projects.

alt text

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


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)

Uploaded Source

Built Distribution

pypotage-1.0.0a0-py3-none-any.whl (9.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page