Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Framework agnostic dependency injections

Project Description

Knot Injector

Framework agnostic dependency injections

This library build as a wrapper for `Knot`_ Dependencies Container.


``pip install knot-injector``



.. code:: python

import sqlalchemy as db
from sqlalchemy.orm import sessionmaker

from knot_injector import Container

registry = Container()

settings = {
'db': {
'uri': 'sqlite://',
'echo': False,
'encoding': 'utf8',

registry.add_service(lambda _: settings, name='settings')

def dbengine(container, settings):
uri = settings['db']['uri']
return create_engine(uri, **settings['db'])

def database_session(container, dbengine):
session = sessionmaker()
return session()

class ItemResource(object):

def on_get(request, response, item_id, dbsession): = dbsession.query(Item).filter( == item_id).one()

.. _Knot:

Release History

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.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(3.4 kB) Copy SHA256 Hash SHA256
Source Apr 7, 2017

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting