
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
A Flexible Service Locator for Python.
svcs (pronounced services) is a dependency container for Python. It 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.
It's suitable for implementing Inversion of Control using either dependency injection or service location while not requiring global state, decorators, or mangling of function signatures.
Benefits:
The goal is to minimize the code for acquiring pluggable services to:
from svcs.your_framework import svcs_from
def view(request):
db, api, cache = svcs_from(request).get(Database, WebAPIClient, Cache)
... or less!
To a type checker like Mypy, db
has the type Database
, api
has the type WebAPIClient
, and cache
has the type Cache
.
db
, api
, and cache
will be automatically cleaned up when the request ends -- it's context managers all the way down.
svcs comes with seamless integration for AIOHTTP, FastAPI, Flask, Pyramid, and Starlette.
While svcs also has first-class support for static typing, it is strictly optional and will always remain so. svcs also doesn't check your types at runtime. It only forwards the type you have asked for to the type checker. If you don't use a type checker, that information is ignored without any runtime overhead.
Read on in Why? or watch this short video if you're intrigued:
Python 3.13 support.
svcs.Registry
now implements a __iter__
method that allows to iterate over its registered services.
#106
Flask: The registry is now stored on app.extensions
, not app.config
.
This is an implementation detail.
If you are directly accessing the registry via app.config
, this is a breaking change, though you should ideally move to svcs.flask.registry
anyway.
#71
#72
#73
Registry.register_factory()
is now more lenient regarding the arguments of the factory.
It only looks at the first argument (if present) and ignores the rest.
#110
Container.aget()
now also enters and exits synchronous context managers.
#93
Container.aget()
now also enters and exits context managers that are returned by async factories.
#105
svcs is written by Hynek Schlawack and distributed under the terms of the MIT license.
The development is kindly supported by my employer Variomedia AG and all my fabulous GitHub Sponsors.
The Bestagon radar logo is made by Lynn Root, based on an Font Awesome icon. svcs has started out as a wrapper around wired by Michael Merickel and has been heavily influenced by it.
FAQs
A Flexible Service Locator
We found that svcs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.