{"id":13458910,"url":"https://github.com/hynek/svcs","last_synced_at":"2025-05-14T18:05:12.791Z","repository":{"id":180652531,"uuid":"665456447","full_name":"hynek/svcs","owner":"hynek","description":"A Flexible Service Locator for Python.","archived":false,"fork":false,"pushed_at":"2025-05-05T17:26:20.000Z","size":1951,"stargazers_count":346,"open_issues_count":3,"forks_count":22,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-05T18:43:50.524Z","etag":null,"topics":["aiohttp","dependency-injection","fastapi","flask","inversion-of-control","ioc","pyramid","python","service-locator","starlette"],"latest_commit_sha":null,"homepage":"https://svcs.hynek.me","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/hynek.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"hynek"}},"created_at":"2023-07-12T08:43:28.000Z","updated_at":"2025-05-05T17:26:22.000Z","dependencies_parsed_at":"2023-12-17T14:29:21.434Z","dependency_job_id":"f5df12c1-d43b-4ad4-aa20-cb10c18c0e99","html_url":"https://github.com/hynek/svcs","commit_stats":{"total_commits":553,"total_committers":8,"mean_commits":69.125,"dds":"0.027124773960216952","last_synced_commit":"82e6f9d999ebd6a1e7178d5d67b5d1c52104b8fc"},"previous_names":["hynek/svc-reg","hynek/svcs"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hynek%2Fsvcs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hynek%2Fsvcs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hynek%2Fsvcs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hynek%2Fsvcs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hynek","download_url":"https://codeload.github.com/hynek/svcs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198514,"owners_count":22030965,"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":["aiohttp","dependency-injection","fastapi","flask","inversion-of-control","ioc","pyramid","python","service-locator","starlette"],"created_at":"2024-07-31T09:00:59.622Z","updated_at":"2025-05-14T18:05:07.777Z","avatar_url":"https://github.com/hynek.png","language":"Python","funding_links":["https://github.com/sponsors/hynek"],"categories":["Software","Python","Third-Party Extensions"],"sub_categories":["DI Frameworks / Containers","General"],"readme":"\u003c!-- begin logo --\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/hynek/svcs/\"\u003e\n    \u003cimg src=\"docs/_static/logo_with_name.svg\" width=\"35%\" alt=\"svcs logo showing a hexagon-shaped radar\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cem\u003eA Flexible Service Locator for Python.\u003c/em\u003e\n\u003c/p\u003e\n\n\u003c!-- end logo --\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://svcs.hynek.me\"\u003e\u003cimg alt=\"Documentation at ReadTheDocs\" src=\"https://img.shields.io/badge/Docs-Read%20The%20Docs-black\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.bestpractices.dev/projects/8115\"\u003e\u003cimg src=\"https://www.bestpractices.dev/projects/8115/badge\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://pypi.org/project/svcs/\"\u003e\u003cimg alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/svcs\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://pypi.org/project/svcs/\"\u003e\u003cimg alt=\"PyPI - Supported Python versions\" src=\"https://img.shields.io/pypi/pyversions/svcs.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n\u003c!-- begin pypi --\u003e\n\u003c!-- begin index --\u003e\n\n*svcs* (pronounced *services*) is a **dependency container** for Python.\nIt gives you a central place to register factories for types/interfaces and then imperatively acquire instances of those types with **automatic cleanup** and **health checks**.\n\nIt's suitable for implementing [Inversion of Control](https://svcs.hynek.me/en/latest/glossary.html#term-Inversion-of-Control) using either **dependency injection** or **service location** while not requiring global state, decorators, or mangling of function signatures.\n\n\u003c!-- begin benefits --\u003e\nBenefits:\n\n- Eliminates tons of repetitive **boilerplate** code,\n- unifies **acquisition** and **cleanups** of services,\n- provides full *static* **type safety** for them,\n- simplifies **testing** through **loose coupling**,\n- improves *live* **introspection** and **monitoring** with **health checks**.\n\nThe goal is to minimize the code for acquiring pluggable services to:\n\n\u003c!-- end index --\u003e\n\u003c!-- end benefits --\u003e\n\n\u003c!-- skip: next --\u003e\n\n```python\nfrom svcs.your_framework import svcs_from\n\ndef view(request):\n    db, api, cache = svcs_from(request).get(Database, WebAPIClient, Cache)\n```\n\n... or less!\n\n\u003c!-- begin addendum --\u003e\nTo a type checker like [Mypy](https://mypy-lang.org), `db` has the type `Database`, `api` has the type `WebAPIClient`, and `cache` has the type `Cache`.\n`db`, `api`, and `cache` will be automatically cleaned up when the request ends -- it's context managers all the way down.\n\u003c!-- end addendum --\u003e\n\n*svcs* comes with seamless integration for **AIOHTTP**, **FastAPI**, **Flask**, **Pyramid**, and **Starlette**.\n\n\u003c!-- begin typing --\u003e\nWhile *svcs* also has first-class support for static typing, it is **strictly optional** and will always remain so.\n*svcs* also doesn't check your types at runtime.\nIt only forwards the type you have asked for to the type checker.\nIf you don't use a type checker, that information is ignored without any runtime overhead.\n\u003c!-- end typing --\u003e\n\nRead on in [*Why?*](https://svcs.hynek.me/en/latest/why.html) or watch this short video if you're intrigued:\n\n[![Watch the video](https://img.youtube.com/vi/d1elMD9WgpA/maxresdefault.jpg)](https://youtu.be/d1elMD9WgpA)\n\n\n## Project Links\n\n- [**PyPI**](https://pypi.org/project/svcs/)\n- [**GitHub**](https://github.com/hynek/svcs)\n- [**Documentation**](https://svcs.hynek.me)\n- [**Changelog**](https://github.com/hynek/svcs/blob/main/CHANGELOG.md)\n- [**Funding**](https://hynek.me/say-thanks/)\n- [**Third-party extensions**](https://github.com/hynek/svcs/wiki/Third%E2%80%90party-Extensions)\n\n\u003c!-- end pypi --\u003e\n\n\n## Credits\n\n*svcs* is written by [Hynek Schlawack](https://hynek.me/) and distributed under the terms of the [MIT](https://github.com/hynek/svcs/blob/main/LICENSE) license.\n\nThe development is kindly supported by my employer [Variomedia AG](https://www.variomedia.de/) and all my fabulous [GitHub Sponsors](https://github.com/sponsors/hynek).\n\nThe [Bestagon](https://www.youtube.com/watch?v=thOifuHs6eY) radar logo is made by [Lynn Root](https://www.roguelynn.com), based on an [Font Awesome](https://fontawesome.com) icon.\n*svcs* has started out as a wrapper around [*wired*](https://wired.readthedocs.io/) by [Michael Merickel](https://michael.merickel.org/) and has been heavily influenced by it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhynek%2Fsvcs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhynek%2Fsvcs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhynek%2Fsvcs/lists"}