Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Just another python DI library.

Project description

# pyhooker

Lightweight and easy-to-use python dependency injection library

Pyhooker is ready to use for Python >=2.7 and >=3.2

[![Build Status](](

## Installation

pip install git+

## Usage

import pyhooker


class IWheel(object):

class MichelinWheel(IWheel):


class IEngine(object):

class OttoEngine(IEngine):


class ICar(object):

class Car(ICar):

@pyhooker.inject_params(engine=IEngine, wheel_type=IWheel)
def __init__(self, engine, wheel_type):
self.engine = engine
self.wheel_type = wheel_type


class Driver(object):

def __init__(self, car): = car


pyhooker.register(ICar, Car)
pyhooker.register(IEngine, OttoEngine)
pyhooker.register(IWheel, MichelinWheel)

driver = Driver()

print("The driver is %s\n... with its car %s\n... and engine %s\n... and wheel type %s" % (driver,,,

Project details

Release history Release notifications

This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pyhooker-1.0.1.tar.gz (25.7 kB) Copy SHA256 hash SHA256 Source None Oct 20, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page