{"id":26348922,"url":"https://github.com/fdorantesm/pynversify","last_synced_at":"2026-06-30T16:31:25.379Z","repository":{"id":279910569,"uuid":"940418028","full_name":"fdorantesm/pynversify","owner":"fdorantesm","description":"A dependency injection container inspired by Inversify for Python.","archived":false,"fork":false,"pushed_at":"2025-03-03T06:01:47.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-01T14:15:57.838Z","etag":null,"topics":["dependency-injection","dependency-injection-container","dependency-inversion","dependency-inversion-principle"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fdorantesm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-28T06:19:11.000Z","updated_at":"2025-03-03T06:03:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"bec23166-8cc1-4aea-a36f-9ccb1ef74f36","html_url":"https://github.com/fdorantesm/pynversify","commit_stats":null,"previous_names":["fdorantesm/pynversify"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/fdorantesm/pynversify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdorantesm%2Fpynversify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdorantesm%2Fpynversify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdorantesm%2Fpynversify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdorantesm%2Fpynversify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fdorantesm","download_url":"https://codeload.github.com/fdorantesm/pynversify/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdorantesm%2Fpynversify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34975668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-30T02:00:05.919Z","response_time":92,"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-injection","dependency-injection-container","dependency-inversion","dependency-inversion-principle"],"created_at":"2025-03-16T08:17:17.139Z","updated_at":"2026-06-30T16:31:25.357Z","avatar_url":"https://github.com/fdorantesm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Inversify for Python\n\nA dependency injection container inspired by Inversify for Python.\n\nThis library supports hierarchical containers, various binding types (toSelf, to, constant, dynamic),\nand scopes (singleton and transient).\n\n## Examples\n\n```py\nfrom inversify import Container, injectable, inject\n\nclass Token:\n    def __init__(self, name):\n        self.name = name\n    def __hash__(self):\n        return hash(self.name)\n    def __eq__(self, other):\n        return isinstance(other, Token) and self.name == other.name\n\n# Tokens for bindings\nLOGGER_TOKEN = Token(\"LOGGER\")\nUSER_SERVICE_TOKEN = Token(\"USER_SERVICE\")\n\n@injectable\nclass Logger:\n    def __init__(self):\n        self.name = \"Parent Logger\"\n    def log(self, message: str):\n        print(f\"[{self.name}]: {message}\")\n\n@injectable\nclass CustomLogger:\n    def __init__(self):\n        self.name = \"Child Logger\"\n    def log(self, message: str):\n        print(f\"[{self.name}]: {message}\")\n\n@injectable\nclass UserService:\n    @inject({'logger': LOGGER_TOKEN})\n    def __init__(self, logger):\n        self.logger = logger\n    def process(self):\n        self.logger.log(\"Processing in UserService\")\n\n# Create parent container and bind tokens\nparent_container = Container()\nparent_container.bind(LOGGER_TOKEN).to(Logger).inSingletonScope()\nparent_container.bind(USER_SERVICE_TOKEN).to(UserService).inTransientScope()\n\n# Create child container and override the LOGGER_TOKEN binding\nchild_container = parent_container.create_child()\nchild_container.bind(LOGGER_TOKEN).to(CustomLogger).inSingletonScope()\n\n# Get services from parent and child containers\nparent_service = parent_container.get(USER_SERVICE_TOKEN)\nchild_service = child_container.get(USER_SERVICE_TOKEN)\n\nparent_service.process()  # Uses Parent Logger\nchild_service.process()   # Uses Child Logger\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffdorantesm%2Fpynversify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffdorantesm%2Fpynversify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffdorantesm%2Fpynversify/lists"}