{"id":13501681,"url":"https://github.com/ikalnytskyi/picobox","last_synced_at":"2025-04-05T03:03:03.085Z","repository":{"id":24432438,"uuid":"101552498","full_name":"ikalnytskyi/picobox","owner":"ikalnytskyi","description":"Dependency injection framework designed with Python in mind.","archived":false,"fork":false,"pushed_at":"2025-01-12T00:48:18.000Z","size":302,"stargazers_count":50,"open_issues_count":5,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T21:36:44.652Z","etag":null,"topics":["dependency-injection","inversion-of-control","lightweight","micro-framework"],"latest_commit_sha":null,"homepage":"https://picobox.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ikalnytskyi.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"ikalnytskyi","custom":"https://send.monobank.ua/2GWDRDwGZ8"}},"created_at":"2017-08-27T13:00:32.000Z","updated_at":"2025-03-16T17:52:49.000Z","dependencies_parsed_at":"2023-11-18T00:12:43.118Z","dependency_job_id":"93558428-69ab-46c6-b832-602b322bd32d","html_url":"https://github.com/ikalnytskyi/picobox","commit_stats":{"total_commits":115,"total_committers":2,"mean_commits":57.5,"dds":0.008695652173912993,"last_synced_commit":"04967e4c18fce57e514cad24e606023925c03d1d"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikalnytskyi%2Fpicobox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikalnytskyi%2Fpicobox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikalnytskyi%2Fpicobox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikalnytskyi%2Fpicobox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ikalnytskyi","download_url":"https://codeload.github.com/ikalnytskyi/picobox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280217,"owners_count":20912967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dependency-injection","inversion-of-control","lightweight","micro-framework"],"created_at":"2024-07-31T22:01:46.188Z","updated_at":"2025-04-05T03:03:03.064Z","avatar_url":"https://github.com/ikalnytskyi.png","language":"Python","funding_links":["https://ko-fi.com/ikalnytskyi","https://send.monobank.ua/2GWDRDwGZ8"],"categories":["Python"],"sub_categories":[],"readme":"Picobox\n=======\n\n.. image:: https://img.shields.io/pypi/l/picobox\n   :target: https://pypi.python.org/pypi/picobox\n   :alt: PyPI - License\n\n.. image:: https://img.shields.io/pypi/v/picobox.svg\n   :target: https://pypi.python.org/pypi/picobox\n   :alt: PyPI - Version\n\n.. image:: https://img.shields.io/pypi/pyversions/picobox\n   :target: https://pypi.python.org/pypi/picobox\n   :alt: PyPI - Python Versions\n\n.. image:: https://img.shields.io/pypi/dm/picobox\n   :target: https://pypi.python.org/pypi/picobox\n   :alt: PyPI - Downloads\n\nPicobox is opinionated dependency injection framework designed to be clean,\npragmatic and with Python in mind. No complex graphs, no implicit injections,\nno type bindings – just picoboxes, and explicit demands!\n\n\nWhy?\n----\n\nBecause we usually want to decouple our code and Python lack of clean and\npragmatic solutions (even third parties).\n\n\nFeatures\n--------\n\n* Support both values and factories.\n* Support scopes (e.g. singleton, threadlocal, contextvars).\n* Push boxes on stack, and use the top one to access values.\n* Thread-safe.\n* Lightweight (~500 LOC including scopes).\n* Zero dependencies.\n* Pure Python.\n* Annotated with types.\n\n\n\nQuickstart\n----------\n\nFirst\n\n.. code:: bash\n\n    $ [sudo] python -m pip install picobox\n\nand then\n\n.. code:: python\n\n    import picobox\n    import requests\n\n\n    @picobox.pass_(\"conf\")\n    @picobox.pass_(\"requests\", as_=\"session\")\n    def get_resource(uri, session, conf):\n        return session.get(conf[\"base_uri\"] + uri)\n\n\n    box = picobox.Box()\n    box.put(\"conf\", {\"base_uri\": \"http://example.com\"})\n    box.put(\"requests\", factory=requests.Session, scope=picobox.threadlocal)\n\n    with picobox.push(box):\n        get_resource(\"/resource\", requests.Session(), {})\n        get_resource(\"/resource\", requests.Session())\n        get_resource(\"/resource\")\n\n\nLinks\n-----\n\n* Documentation: https://picobox.readthedocs.io\n* Source: https://github.com/ikalnytskyi/picobox\n* Bugs: https://github.com/ikalnytskyi/picobox/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikalnytskyi%2Fpicobox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fikalnytskyi%2Fpicobox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikalnytskyi%2Fpicobox/lists"}