{"id":16854550,"url":"https://github.com/bswck/injection","last_synced_at":"2025-06-23T16:41:37.145Z","repository":{"id":218443678,"uuid":"741741685","full_name":"bswck/injection","owner":"bswck","description":"Create Python variables on the fly.","archived":false,"fork":false,"pushed_at":"2024-12-29T02:51:14.000Z","size":584,"stargazers_count":89,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-01T11:53:21.931Z","etag":null,"topics":["lazy-importing","lazy-imports","pep-690","python"],"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/bswck.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"bswck"}},"created_at":"2024-01-11T02:32:51.000Z","updated_at":"2025-03-13T12:02:23.000Z","dependencies_parsed_at":"2024-01-22T01:17:47.365Z","dependency_job_id":"bffb7d4b-1951-4ccd-a2d2-118c2135fcc8","html_url":"https://github.com/bswck/injection","commit_stats":null,"previous_names":["bswck/lazy-imports","bswck/lazy_importing","bswck/slothy","bswck/injection"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bswck%2Finjection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bswck%2Finjection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bswck%2Finjection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bswck%2Finjection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bswck","download_url":"https://codeload.github.com/bswck/injection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045233,"owners_count":21038553,"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":["lazy-importing","lazy-imports","pep-690","python"],"created_at":"2024-10-13T13:55:54.633Z","updated_at":"2025-04-09T13:08:31.142Z","avatar_url":"https://github.com/bswck.png","language":"Python","funding_links":["https://github.com/sponsors/bswck"],"categories":["Python"],"sub_categories":[],"readme":"# injection\n\n## How does that work?\n_injection_ makes it possible to hook into variable name lookup via inserting a special key into scope dictionaries.\n\n### Example\n```py\nfrom functools import partial\nfrom random import randint\n\nfrom injection import inject\n\nroll: int\ninject(\"roll\", into=locals(), factory=partial(randint, 1, 6))\n\nprint(roll, type(roll) is int)  # 6 True\nprint(roll, type(roll) is int)  # 4 True\nprint(roll, type(roll) is int)  # 3 True\n\n# you never know what the value of roll will be!\n```\n\nIt could be used for various purposes, for instance as a robust replacement for Flask's [local proxies](https://flask.palletsprojects.com/en/stable/reqcontext/#notes-on-proxies) or to implement pure-Python PEP 690\nthat would import things on first reference.\n\n# Legal Info\n© Copyright by Bartosz Sławecki ([@bswck](https://github.com/bswck)).\n\u003cbr /\u003eThis software is licensed under the terms of [MIT License](https://github.com/bswck/injection/blob/HEAD/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbswck%2Finjection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbswck%2Finjection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbswck%2Finjection/lists"}