{"id":31787308,"url":"https://github.com/dlski/python-di","last_synced_at":"2025-10-10T13:58:13.252Z","repository":{"id":57456902,"uuid":"335739837","full_name":"dlski/python-di","owner":"dlski","description":"Fully automatic dependency injection for Python using annotations / type hints.","archived":false,"fork":false,"pushed_at":"2021-04-07T19:57:38.000Z","size":114,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-23T05:37:32.508Z","etag":null,"topics":["annotations","ddd","dependency-injection","domain-driven-design","enterprise","enterprise-architecture","python-di","python3","type-hints"],"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/dlski.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}},"created_at":"2021-02-03T20:00:41.000Z","updated_at":"2022-05-14T11:18:57.000Z","dependencies_parsed_at":"2022-09-15T13:02:00.101Z","dependency_job_id":null,"html_url":"https://github.com/dlski/python-di","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/dlski/python-di","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlski%2Fpython-di","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlski%2Fpython-di/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlski%2Fpython-di/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlski%2Fpython-di/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dlski","download_url":"https://codeload.github.com/dlski/python-di/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlski%2Fpython-di/sbom","scorecard":{"id":347312,"data":{"date":"2025-08-11","repo":{"name":"github.com/dlski/python-di","commit":"04dcdf58f3cf820e2d2ba5086e4e89822ae1f409"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"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":"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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","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":"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":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:102: update your workflow using https://app.stepsecurity.io/secureworkflow/dlski/python-di/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:103: update your workflow using https://app.stepsecurity.io/secureworkflow/dlski/python-di/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:112: update your workflow using https://app.stepsecurity.io/secureworkflow/dlski/python-di/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:125: update your workflow using https://app.stepsecurity.io/secureworkflow/dlski/python-di/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:142: update your workflow using https://app.stepsecurity.io/secureworkflow/dlski/python-di/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:143: update your workflow using https://app.stepsecurity.io/secureworkflow/dlski/python-di/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:146: update your workflow using https://app.stepsecurity.io/secureworkflow/dlski/python-di/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/dlski/python-di/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/dlski/python-di/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/dlski/python-di/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/dlski/python-di/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:60: update your workflow using https://app.stepsecurity.io/secureworkflow/dlski/python-di/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:63: update your workflow using https://app.stepsecurity.io/secureworkflow/dlski/python-di/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:89: update your workflow using https://app.stepsecurity.io/secureworkflow/dlski/python-di/ci.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:108","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:37","Info:   0 out of  11 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"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":"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":"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":"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":"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"}}]},"last_synced_at":"2025-08-18T07:24:52.045Z","repository_id":57456902,"created_at":"2025-08-18T07:24:52.045Z","updated_at":"2025-08-18T07:24:52.045Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279004065,"owners_count":26083668,"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-10-10T02:00:06.843Z","response_time":62,"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":["annotations","ddd","dependency-injection","domain-driven-design","enterprise","enterprise-architecture","python-di","python3","type-hints"],"created_at":"2025-10-10T13:58:11.281Z","updated_at":"2025-10-10T13:58:13.244Z","avatar_url":"https://github.com/dlski.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# python-di\n\n[![CI](https://github.com/dlski/python-di/actions/workflows/ci.yml/badge.svg?branch=master\u0026event=push)](https://github.com/dlski/python-di/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/dlski/python-di/branch/master/graph/badge.svg?token=DXIZA2T8W6)](https://codecov.io/gh/dlski/python-di)\n[![pypi](https://img.shields.io/pypi/v/python-di.svg)](https://pypi.python.org/pypi/python-di)\n[![downloads](https://img.shields.io/pypi/dm/python-di.svg)](https://pypistats.org/packages/python-di)\n[![versions](https://img.shields.io/pypi/pyversions/python-di.svg)](https://github.com/dlski/python-di)\n[![license](https://img.shields.io/github/license/dlski/python-di.svg)](https://github.com/dlski/python-di/blob/master/LICENSE)\n\nFully automatic dependency injection for python 3.7, 3.8, 3.9, pypy3 using (not only) argument annotations / type hints.\n\nCorresponds to clean architecture patterns and ideal for business applications created in DDD / Hexagonal architecture flavour.\nNo external dependencies - uses only standard libraries.\n\nKey features:\n- automatic type matching based on type hints / type annotations - \n  no manual configuration is needed, it just works out of the box\n- configurable object aggregation injection - \n  DI can join `SomeClass` objects and inject into argument annotated as `Collection[SomeClass]`\n- not harm existing codebase - \n  no decorators, no extra metadata are needed in existing codebase to make app construction possible\n- no singletons or global DI process state -\n  app or any app components can be instantiated independently as many times as needed\n- transparency of DI process - \n  static dependency graph and injection plan is built, informative exceptions on error cases\n  (like cyclic dependency or missing elements)\n\n## Help\nComing soon...\n\n## An Example\nApplication domain located in `mod_simple.py`:\n```py\nfrom typing import List\n\n\nclass Repo:\n    def read(self) -\u003e List[str]:\n        raise NotImplementedError\n\n\nclass DomainAction:\n    def __init__(self, repo: Repo):\n        self.repo = repo\n\n    def present(self) -\u003e str:\n        joined = \", \".join(self.repo.read())\n        return f\"Data found: {joined}\"\n```\n\nApplication concretes located in `mod_simple_impl.py`:\n```py\nfrom typing import List\n\nfrom mod_simple import Repo\n\n\nclass MockupRepo(Repo):\n    def read(self) -\u003e List[str]:\n        return [\"di\", \"test\"]\n```\n\nAutomatic application construction:\n```py\nfrom di.declarative import DeclarativeApp, DeclarativeModule, scan_factories\nimport mod_simple, mod_simple_impl\n\n\ndef main():\n    # create app definition\n    app_def = DeclarativeApp(\n        DeclarativeModule(\n            # automatically add factories from `mod_simple` and `mod_simple_impl`\n            scan_factories(mod_simple, mod_simple_impl),\n        )\n    )\n\n    # build app\n    instance = app_def.build_instance()\n\n    # get initialized `DomainAction` object\n    action, = instance.values_by_type(mod_simple.DomainAction)\n\n    # check app works\n    assert action.present() == \"Data found: di, test\"\n```\n\n## More examples\nMore working examples are available in `tests/di/declarative/`.\nPlease see [tests/di/declarative/test_build.py](tests/di/declarative/test_build.py) for reference.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlski%2Fpython-di","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdlski%2Fpython-di","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlski%2Fpython-di/lists"}