Skip to main content
PyPI - License PyPI - Version PyPI - Python Versions PyPI - Downloads

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 (~500 LOC including scopes).

  • Zero dependencies.

  • Pure Python.

  • Annotated with types.

Quickstart

First

$ [sudo] python -m pip install picobox

and then

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")

Metadata

Release files for picobox 4.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for picobox 4.0.0
File Size Uploaded Provenance Actions
picobox-4.0.0.tar.gz 22.7 kB Without provenance Details for picobox-4.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for picobox 4.0.0
File Interpreter ABI Platform Actions
picobox-4.0.0-py3-none-any.whl Python 3 none any Details for picobox-4.0.0-py3-none-any.whl

Total release size: 34.3 kB

Release files / picobox-4.0.0.tar.gz

Download URL picobox-4.0.0.tar.gz
Size 22.7 kB
Tags Source
SHA-256 checksum
How to use checksums
114da1b5606b2f615e8b0eb68d04198ad9de75af5adbcf5b36fe4f664ab927b6
BLAKE2b-256 checksum
How to use checksums
0fb1830714dd6778c1cb45826722b4e9bd21c94b33cca5df9ef2cc0b80c81b25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / picobox-4.0.0-py3-none-any.whl

Download URL picobox-4.0.0-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c27eb689fe45dabd9e64c382e04418147d0b746d155b4e80057dbb7ff82027e
BLAKE2b-256 checksum
How to use checksums
2dc6fd64ffd75d47c4fcf6c65808cc5c5c75e5d4357c197d3741ee1339e91257
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Security for picobox 4.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page