All Projects → ikalnytskyi → Picobox

ikalnytskyi / Picobox

Licence: mit
Dependency injection framework designed with Python in mind.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Picobox

Ioc
🦄 lightweight (<1kb) inversion of control javascript library for dependency injection written in typescript
Stars: ✭ 171 (+388.57%)
Mutual labels:  lightweight, dependency-injection, inversion-of-control
siringa
Minimalist dependency injection library for Python that embraces type annotations syntax
Stars: ✭ 51 (+45.71%)
Mutual labels:  dependency-injection, inversion-of-control
di.libx.js
💉 di.libx.js - Lightweight & non intrusive Dependency Injection module that supports async/deferred resolution and uglified support
Stars: ✭ 32 (-8.57%)
Mutual labels:  dependency-injection, inversion-of-control
brisk-ioc
fast light brisk ioc/di container on nodejs; Node下快速 轻量的IoC/DI容器,依赖注入,配合装饰器使用
Stars: ✭ 12 (-65.71%)
Mutual labels:  lightweight, dependency-injection
telephone-ts
Telephone-ts: The "Event Emitter-less" TypeScript Event Architecture.
Stars: ✭ 22 (-37.14%)
Mutual labels:  dependency-injection, inversion-of-control
saber
Dependency injection (DI) & Inversion of Control (IoC) command line tool for Swift based on code generation
Stars: ✭ 21 (-40%)
Mutual labels:  dependency-injection, inversion-of-control
pythondi
Python lightweight dependency injection library
Stars: ✭ 26 (-25.71%)
Mutual labels:  dependency-injection, inversion-of-control
vue-ioc
IoC and DI for Vue powered by InversifyJS and inspired by Angular Module syntactic sugar.
Stars: ✭ 39 (+11.43%)
Mutual labels:  dependency-injection, inversion-of-control
Modulation
Modulation - explicit dependency management for Ruby
Stars: ✭ 306 (+774.29%)
Mutual labels:  dependency-injection, inversion-of-control
Ditranquillity
Dependency injection for iOS (Swift)
Stars: ✭ 317 (+805.71%)
Mutual labels:  dependency-injection, inversion-of-control
Inversify Express Utils
Some utilities for the development of Express application with InversifyJS
Stars: ✭ 454 (+1197.14%)
Mutual labels:  dependency-injection, inversion-of-control
nodejs-boilerplate
Clean Architecture for node.js projects (Typescript + Express + TypeORM + Typedi)
Stars: ✭ 199 (+468.57%)
Mutual labels:  dependency-injection, inversion-of-control
Griffin.Container
Inversion of control container with (almost) zero configuration
Stars: ✭ 13 (-62.86%)
Mutual labels:  dependency-injection, inversion-of-control
diod
A very opinionated inversion of control (IoC) container and dependency injector for Typescript, Node.js or browser apps.
Stars: ✭ 36 (+2.86%)
Mutual labels:  dependency-injection, inversion-of-control
ThunderboltIoc
One of the very first IoC frameworks for .Net that has no reflection. An IoC that casts its services before thunder casts its bolts.
Stars: ✭ 40 (+14.29%)
Mutual labels:  dependency-injection, inversion-of-control
granitic
Web/micro-services and IoC framework for Golang developers
Stars: ✭ 32 (-8.57%)
Mutual labels:  dependency-injection, inversion-of-control
Dryioc
DryIoc is fast, small, full-featured IoC Container for .NET
Stars: ✭ 555 (+1485.71%)
Mutual labels:  dependency-injection, inversion-of-control
di
Simple and yet powerful Dependency Injection for Go
Stars: ✭ 188 (+437.14%)
Mutual labels:  dependency-injection, inversion-of-control
inversify-koa-utils
inversify-koa-utils is a module based on inversify-express-utils. This module has utilities for koa 2 applications development using decorators and IoC Dependency Injection (with inversify)
Stars: ✭ 27 (-22.86%)
Mutual labels:  dependency-injection, inversion-of-control
Kangaru
🦘 A dependency injection container for C++11, C++14 and later
Stars: ✭ 297 (+748.57%)
Mutual labels:  dependency-injection, inversion-of-control

Picobox

.. image:: https://img.shields.io/pypi/v/picobox.svg :target: https://pypi.python.org/pypi/picobox

.. image:: https://travis-ci.com/ikalnytskyi/picobox.svg?branch=master :target: https://travis-ci.com/ikalnytskyi/picobox.svg?branch=master

.. image:: https://codecov.io/gh/ikalnytskyi/picobox/branch/master/graph/badge.svg :target: https://codecov.io/gh/ikalnytskyi/picobox

.. image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg :target: https://saythanks.io/to/[email protected]

Picobox is opinionated dependency injection framework designed to be clean, pragmatic and with Python in mind. No complex graphs, no implicit injections, no type bindings – just picoboxes, and explicit demands!

Why?

Because we usually want to decouple our code and Python lack of clean and pragmatic solutions (even third parties).

Features

  • Support both values and factories.
  • Support scopes (e.g. singleton, threadlocal, contextvars).
  • Push boxes on stack, and use the top one to access values.
  • Thread-safe.
  • Lightweight (~450 LOC including scopes).
  • Zero dependencies (on python3).
  • Pure Python.

Quickstart

First

.. code:: bash

$ [sudo] python -m pip install picobox

and then

.. code:: python

import picobox
import requests

@picobox.pass_('conf')
@picobox.pass_('requests', as_='session')
def get_resource(uri, session, conf):
    return session.get(conf['base_uri'] + uri)

box = picobox.Box()
box.put('conf', {'base_uri': 'http://example.com'})
box.put('requests', factory=requests.Session, scope=picobox.threadlocal)

with picobox.push(box):
    get_resource('/resource', requests.Session(), {})
    get_resource('/resource', requests.Session())
    get_resource('/resource')

Links

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].