{"library":"picobox","title":"Picobox Dependency Injection","description":"Picobox is an opinionated, lightweight (around 500 LOC) dependency injection framework for Python, designed to be clean and pragmatic. It focuses on explicit demands without complex graphs, implicit injections, or XML configurations. The current version is 4.0.0, and it maintains an active development with regular major and minor releases, including support for new Python versions and deprecations of older ones.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install picobox"],"cli":null},"imports":["import picobox","from picobox import Box","from picobox import push","from picobox import pass_","from picobox import singleton","from picobox import threadlocal","from picobox import contextvars"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import picobox\n\nclass MyService:\n    def __init__(self, config_value: int):\n        self.config_value = config_value\n\n    def do_work(self) -> str:\n        return f\"Working with config: {self.config_value}\"\n\n# 1. Create a Box instance\nbox = picobox.Box()\n\n# 2. Put dependencies into the box\n# 'my_config' is a simple value\nbox.put('my_config', 123)\n\n# 'my_service' is a factory, instantiated once per injection or scope\nbox.put('my_service', factory=MyService, scope=picobox.singleton, depends=['my_config'])\n\n# 3. Use picobox.push to make the box active (often as a context manager)\nwith picobox.push(box):\n    # 4. Define a function that needs dependencies, using @picobox.pass_\n    @picobox.pass_('my_service')\n    @picobox.pass_('my_config', as_='cfg_val')\n    def run_application(my_service: MyService, cfg_val: int):\n        print(f\"Retrieved config value: {cfg_val}\")\n        print(my_service.do_work())\n\n    run_application()","lang":"python","description":"This quickstart demonstrates defining a `Box`, adding both value and factory dependencies with scoping, and then using the `@picobox.pass_` decorator to inject these dependencies into a function. The `picobox.push()` function is used as a context manager to activate the box for the current scope.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"4.0.0","pypi_latest":"4.0.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.7,"avg_import_s":0.04,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"picobox","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":1.5,"disk_size":"17.9M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"picobox","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0.02,"mem_mb":1.5,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"picobox","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.06,"mem_mb":1.8,"disk_size":"19.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"picobox","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0.04,"mem_mb":1.8,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"picobox","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.05,"mem_mb":1.6,"disk_size":"11.6M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"picobox","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.05,"mem_mb":1.6,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"picobox","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.04,"mem_mb":2,"disk_size":"11.3M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"picobox","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.04,"mem_mb":1.8,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"picobox","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":1.4,"disk_size":"17.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"picobox","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.9,"import_time_s":0.02,"mem_mb":1.4,"disk_size":"18M"}]}}