--- id: picobox version: "4.0.0" license: unclear license_treatment: permissive maintenance: aging --- # picobox — Dependency injection framework designed with Python in mind. License: permissive · Maintenance: aging · Downloads: 310.3K/mo ## What it is and what it does Picobox is a dependency injection framework that decouples code by managing object creation and lifecycle through explicit registration in named boxes. You register values or factories into a box, then use decorators to inject them into functions—the framework handles scope management (singleton, threadlocal, contextvars) and ensures thread-safe access. It avoids implicit injection and complex dependency graphs in favor of pragmatic, explicit demands. The framework is designed for developers who want clean decoupling without heavyweight machinery. It supports both static values and factory functions, allows you to push boxes onto a stack for context-aware resolution, and stays lightweight at ~500 lines of code with no external dependencies. It works across Python 3.8–3.12 and both CPython and PyPy. Use it for: - Inject configuration objects and database connections into request handlers in web applications. - Manage thread-local or context-local service instances in multi-threaded or async codebases. - Decouple business logic from external dependencies like HTTP clients or logging systems. - Create testable code by swapping real implementations with mocks via different boxes. - Organize factory functions for complex object creation without polluting module scope. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Picobox is a lightweight dependency injection framework that manages object creation and scoping through explicit box-based registration and retrieval, with support for both values and factories. Yes, if you want a pragmatic, lightweight DI solution without external dependencies. The zero-dependency design, thread-safety, and explicit injection model make it suitable for small to medium projects. However, the aging maintenance status means you should verify compatibility with your target Python version and assess whether the lack of recent updates aligns with your project's stability requirements. ## Install pip install picobox uv add picobox poetry add picobox ## Installing picobox Before you install: Installation is frictionless—the package is pure Python with zero runtime dependencies and ships as a wheel. The codebase is lightweight (~500 LOC) and well-typed. Maintenance is aging: the last release was in November 2023, though the repository remains active. License in practice: Licensed under MIT (permissive), so you can use, modify, and distribute picobox freely in commercial and open-source projects with minimal restrictions. Quickstart: import picobox box = picobox.Box() box.put("key", "value") with picobox.push(box): @picobox.pass_("key") def my_func(val): return val result = my_func() Requires Python 3.8 or later. Verify before relying: - Whether the aging maintenance status affects stability or compatibility with newer Python versions. - Real-world performance characteristics under high-concurrency workloads despite thread-safety claims. - Adoption patterns and ecosystem maturity relative to other DI frameworks in Python. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 310.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags dependency injection framework, service locator pattern, object factory management, scope management singleton, inversion of control container, thread-safe dependency resolution, lightweight DI container, dependency-injection, inversion-of-control, zero-dependencies [View on SkillFed](https://skillfed.io/packages/picobox) · [View on PyPI](https://pypi.org/project/picobox/)