{"id":15442898,"url":"https://github.com/tailhook/injections","last_synced_at":"2026-03-07T18:05:24.218Z","repository":{"id":17056164,"uuid":"19820742","full_name":"tailhook/injections","owner":"tailhook","description":"Simple dependency injection library for python2 and python3","archived":false,"fork":false,"pushed_at":"2015-07-16T17:54:58.000Z","size":216,"stargazers_count":39,"open_issues_count":0,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-08-29T08:44:50.703Z","etag":null,"topics":["dependency","di","injection","python","python2","python3"],"latest_commit_sha":null,"homepage":"","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/tailhook.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}},"created_at":"2014-05-15T13:41:54.000Z","updated_at":"2024-06-29T13:48:41.000Z","dependencies_parsed_at":"2022-08-04T16:15:30.327Z","dependency_job_id":null,"html_url":"https://github.com/tailhook/injections","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/tailhook/injections","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailhook%2Finjections","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailhook%2Finjections/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailhook%2Finjections/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailhook%2Finjections/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tailhook","download_url":"https://codeload.github.com/tailhook/injections/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailhook%2Finjections/sbom","scorecard":{"id":865871,"data":{"date":"2025-08-11","repo":{"name":"github.com/tailhook/injections","commit":"564e077ad5445c12952a92fe1f685f8c6a8d2667"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":1,"reason":"Found 2/15 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T02:41:08.780Z","repository_id":17056164,"created_at":"2025-08-24T02:41:08.780Z","updated_at":"2025-08-24T02:41:08.780Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30225512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T17:00:40.062Z","status":"ssl_error","status_checked_at":"2026-03-07T17:00:39.026Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","di","injection","python","python2","python3"],"created_at":"2024-10-01T19:31:22.417Z","updated_at":"2026-03-07T18:05:24.193Z","avatar_url":"https://github.com/tailhook.png","language":"Python","readme":"==========\nInjections\n==========\n\n\nInjections is a simple dependency injection library which is intended to\ncleanup object dependency hell.\n\n\nUsage\n=====\n\nDeclare a class' dependencies::\n\n    @injections.has\n    class Hello(object):\n\n        world = injections.depends(World, 'universe')\n\nYou must decorate class with ``@injections.has``. All dependencies has a\ntype(class), which is ``World`` in this case, and a name, which is ``universe``\nin this case. This is for having multiple similar dependencies.\n\nNote: Name of dependency is unique among all services in single dependency\ninjector and not tied to particular type. This is done to easier support\nsubclassing of dependencies (and you can also register subclass with abc\ninstead of subclassing directly)\n\nThen at some initialisation code you create dependency injector, and set\napropriate services::\n\n    inj = injections.Container()\n    inj['universe'] = World()\n\nNow you can create ``Hello`` instances and inject dependencies to them::\n\n    hello = inj.inject(Hello())\n    assert hello.world is inj['universe']\n\nAnd you can propagate dependencies starting from existing instances::\n\n    h2 = injections.propagate(hello, Hello())\n    assert h2.world is hello.world\n\n\nIf you need do some class initialization when dependencies are ready, you\nmust do the work in ``__injected__`` method instead of ``__init__``::\n\n    @injections.has\n    class CachedValue(object):\n        redis = injections.depends(Redis)\n        def __injected__(self):\n            self.cached_value = self.redis.get('cache')\n\nIf you need to propagate some dependencies, you are probably want do do\nit in the ``__injected__`` method too::\n\n    @injections.has\n    class Child:\n        redis = injections.depends(Redis)\n\n    @injections.has\n    class Parent:\n        def __injected__(self):\n            self.child = injections.propagate(self, Child())\n\n\nNote: In the last two examples where name is omitted, it's got from\nthe name of the attribute to assign to. It's used to avoid repetitive\ntyping, but may be error prone.\n\n\nCyclic Dependencies\n===================\n\n\nDependencies between objects might be cyclic as long as object don't use\neach other in ``__injected__`` method. To handle cyclic depencency between\nclasses ``A`` and ``B`` use code similar to the following:\n\n.. code-block:: python\n\n   inj['a'] = A()\n   inj['b'] = B()\n   inj.inject(inj['a'])\n   inj.inject(inj['b'])\n\n\nAutomatic Interconnection (experimental)\n========================================\n\nSometimes it's useful to omit ``inject()`` calls for the objects put in\ncontainer, and then connect them all using ``interconnect_all()``:\n\n.. code-block:: python\n\n   inj['a'] = A()\n   inj['b'] = B()\n   inj['c'] = C()\n   inj.interconnect_all()\n\nThis will call ``inj.inject`` for all objects in container in proper order\n(using topology sort based on their dependencies). It doesn't make your\ncontainer sealed, so you can add more dependencies later, and interconnect new\nones too.\n\nNote: Cyclic dependencies are not processed by ``interconnect_all``, so you\nmust either do ``inject()`` for them (in proper order) *before* calling\ninterconnect, or *add* them to the container *after*.  In any case\n*injections* will not try to guess, but will fail with runtime exception if\ncan't find out proper order.\n\n\nHistory\n=======\n\nThe library was ininitally named ``zorro.di`` and was a part of zorro_\nnetworking library.\n\n.. _zorro: http://github.com/tailhook/zorro\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftailhook%2Finjections","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftailhook%2Finjections","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftailhook%2Finjections/lists"}