{"id":16544465,"url":"https://github.com/steinitzu/giveme","last_synced_at":"2025-03-21T10:31:32.324Z","repository":{"id":52706282,"uuid":"91917144","full_name":"steinitzu/giveme","owner":"steinitzu","description":"A simple python dependency injector","archived":false,"fork":false,"pushed_at":"2023-08-08T20:39:23.000Z","size":63,"stargazers_count":10,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-13T17:05:55.560Z","etag":null,"topics":["dependency-injection","di-framework","inversion-of-control","python","python3-library"],"latest_commit_sha":null,"homepage":null,"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/steinitzu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2017-05-20T21:25:27.000Z","updated_at":"2025-02-06T04:47:23.000Z","dependencies_parsed_at":"2024-10-28T10:17:36.138Z","dependency_job_id":"3510c392-1ec7-4d3e-b4b5-413aa65d7c48","html_url":"https://github.com/steinitzu/giveme","commit_stats":{"total_commits":42,"total_committers":3,"mean_commits":14.0,"dds":"0.23809523809523814","last_synced_commit":"d9d03a1501f5ca63553b9e833e9b94789380a124"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinitzu%2Fgiveme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinitzu%2Fgiveme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinitzu%2Fgiveme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinitzu%2Fgiveme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steinitzu","download_url":"https://codeload.github.com/steinitzu/giveme/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244130279,"owners_count":20402756,"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","di-framework","inversion-of-control","python","python3-library"],"created_at":"2024-10-11T19:02:50.558Z","updated_at":"2025-03-21T10:31:31.976Z","avatar_url":"https://github.com/steinitzu.png","language":"Python","readme":"- [Documentation](#org7e529b6)\n- [Quick start](#org07a14b0)\n- [Install](#orgfce85dd)\n- [Changes in version 1.0](#orgd8ed99f)\n  - [Migrating from \u003c1.0](#org4c92880)\n- [Testing](#orgdce1e44)\n- [Contributing](#org6ef425e)\n\n[![Build Status](https://travis-ci.org/steinitzu/giveme.svg?branch=master)](https://travis-ci.org/steinitzu/giveme)\n\n# Giveme: dependency injection for python\n\nGiveMe is a simple, no-nonsense dependency injection framework for python.\n\nIts features include:\n\n-   Simple `register` and `inject` decorators to register dependency factories or classes and inject their return value into other function/method arguments.\n-   Painfree configuration for singleton and thread local dependencies\n-   Injected dependencies can always be overridden by manually passed arguments (great for testing)\n\n\n\u003ca id=\"org7e529b6\"\u003e\u003c/a\u003e\n\n# Documentation\n\nExamples and API documentation can be found on ReadTheDocs: \u003chttps://giveme.readthedocs.io\u003e\n\n\n\u003ca id=\"org07a14b0\"\u003e\u003c/a\u003e\n\n# Quick start\n\n```python\nfrom giveme import Injector\n\ninjector = Injector()\n\n@injector.register\ndef magic_number():\n    return 42\n\n@injector.inject\ndef multiply(n, magic_number):\n    return n*magic_number\n\nmultiply(2)\n```\n\n```python\n84\n```\n\nGiveMe has many more advanced options, for more examples and full API documentation please visit \u003chttps://giveme.readthedocs.io\u003e\n\n\n\u003ca id=\"orgfce85dd\"\u003e\u003c/a\u003e\n\n# Install\n\n`pip install giveme`\n\nPython3.8 and up are supported.\n\n\n\u003ca id=\"orgd8ed99f\"\u003e\u003c/a\u003e\n\n# Changes in version 1.0\n\nGiveMe has received some improvements in 1.0:\n\n-   New `Injector` class with `register` and `inject` decorators as instance methods. To support more than one dependency registry in a project.\n-   Module level decoraters `giveme.register` and `giveme.inject` have been deprecated, `Injector.register` and `Injector.inject` should be used instead.\n-   Vastly improved argument binding in `Injector.inject` which acts in accordance to default python argument binding. Better distinction between injected arguments and manually passed arguments.\n-   `DependencyNotFoundError` thrown from `inject` when an explicitly mapped (e.g. arg\u003csub\u003ename\u003c/sub\u003e='dependency\u003csub\u003ename\u003c/sub\u003e') dependency is not registered or passed in manually for easier debugging\n-   `DependencyNotFoundWarning` raised in ambigious cases where an argument is not explicitly mapped to dependency and not passed in manually.\n\n\n\u003ca id=\"org4c92880\"\u003e\u003c/a\u003e\n\n## Migrating from \u003c1.0\n\nThe API is mostly the same. If you were using the module levels decorators in a standard way before:\n\n```python\nfrom giveme import register, inject\n\n@register\ndef something():\n    ...\n\n@inject\ndef do_stuff(something):\n    ...\n```\n\nThe only change you'll have to make is to create an instance of `Injector` and use its instance method decorators instead:\n\n```python\nfrom giveme import Injector\n\ninjector = Injector()\n\n@injector.register\ndef something():\n    ...\n\n@injector.inject\ndef do_stuff(something):\n    ...\n```\n\n\n\u003ca id=\"orgdce1e44\"\u003e\u003c/a\u003e\n\n# Testing\n\nYou can run the included test suite with pytest\n\n1.  Clone this repository\n2.  cd path/to/giveme\n3.  Install pytest -\u003e `pip install pytest`\n4.  Run the tests -\u003e `pytest tests.py`\n\n\n\u003ca id=\"org6ef425e\"\u003e\u003c/a\u003e\n\n# Contributing\n\nPull requests are welcome. Please post any bug reports, questions and suggestions to the issue tracker \u003chttps://github.com/steinitzu/giveme/issues\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteinitzu%2Fgiveme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteinitzu%2Fgiveme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteinitzu%2Fgiveme/lists"}