{"id":17892770,"url":"https://github.com/neetjn/python-inject-practice","last_synced_at":"2025-08-11T17:11:15.170Z","repository":{"id":79658744,"uuid":"173325175","full_name":"neetjn/python-inject-practice","owner":"neetjn","description":"Practice with python dependency injection using python-inject @ https://github.com/ivankorobkov/python-inject","archived":false,"fork":false,"pushed_at":"2019-04-10T18:10:41.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T03:45:14.521Z","etag":null,"topics":["dependency","dependency-injection","inject","python","python-inject"],"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/neetjn.png","metadata":{"files":{"readme":"README.md","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}},"created_at":"2019-03-01T15:31:15.000Z","updated_at":"2019-04-10T18:10:43.000Z","dependencies_parsed_at":"2023-05-14T07:15:17.801Z","dependency_job_id":null,"html_url":"https://github.com/neetjn/python-inject-practice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/neetjn/python-inject-practice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neetjn%2Fpython-inject-practice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neetjn%2Fpython-inject-practice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neetjn%2Fpython-inject-practice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neetjn%2Fpython-inject-practice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neetjn","download_url":"https://codeload.github.com/neetjn/python-inject-practice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neetjn%2Fpython-inject-practice/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269922993,"owners_count":24497025,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","dependency-injection","inject","python","python-inject"],"created_at":"2024-10-28T14:44:19.552Z","updated_at":"2025-08-11T17:11:15.144Z","avatar_url":"https://github.com/neetjn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# python-inject-practice\n\u003e Practice with python dependency injection using python-inject @ https://github.com/ivankorobkov/python-inject\n\nThis project was created to learn how to perform dependency injection, the pythonic way using [**python-inject**](https://github.com/ivankorobkov/python-inject). I'll be recording my thoughts and experiments in this repository.\n\n## Experiments\n\n* \"instance\" injection using **python-inject**. This injection strategy allows me to pull a binded dependency by object type from my injector given my configuration. See: [instance_injection.py](https://github.com/neetjn/python-inject-practice/instance_injection.py)\n\n* \"attribute\" injection using **python-inject**. This injection strategy allows me to bind a dependency from my injector into class instances. See: [attribute_injection.py](https://github.com/neetjn/python-inject-practice/attribute_injection.py)\n\n* \"param\" injection using **python-inject**. This injection strategy allows me to inject dependencies into methods by param position or key. See: [param_injection.py](https://github.com/neetjn/python-inject-practice/param_injection.py)\n\n## What I've Learned\n\n\u003e Preface: Until recently (3/1/2019) I've never *knowingly* used dependency injection. The design pattern was not something I was consciously aware of, however I leverage it almost daily in both personal projects and in production.\n\n* Dependency injection is more of a development pattern than anything else.\n* Contrary to my original confusion, there are multiple ways of tackling dependency injection.\n* Angular.js, which I've been actively using for the past couple of years, revolves around dependency injection:\n  ```\n  angular.module('myModule', [])\n    .factory('serviceId', ['depService', depService =\u003e {\n      // ...\n    }])*\n  ```\n* DI with **python-inject** can be very powerful with proper context control. IoC can also be incredibly helpful when using asynchronous code.\n\n## Resources\n\n* Wikipedia (Dependency injection) - https://en.wikipedia.org/wiki/Dependency_injection\n* baeldung (IoC and Dependency Injection in Spring) - https://www.baeldung.com/inversion-control-and-dependency-injection-in-spring\n* angularjs/docs - https://docs.angularjs.org/guide/di\n* pinject - https://github.com/google/pinject\n* preslav (Dependency Injection In Python - The Java Guy's Perspective) - https://preslav.me/2018/12/20/dependency-injection-in-python/\n\n___\n\nCopyright (c) 2019 John Nolette Licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneetjn%2Fpython-inject-practice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneetjn%2Fpython-inject-practice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneetjn%2Fpython-inject-practice/lists"}