Skip to main content

svcs logo showing a hexagon-shaped radar

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:

  • Eliminates tons of repetitive boilerplate code,
  • unifies acquisition and cleanups of services,
  • provides full static type safety for them,
  • simplifies testing through loose coupling,
  • improves live introspection and monitoring with health checks.

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, 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, and Starlette. Even more community-supported integrations can be found in our project wiki.

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:

Watch the video

Release Information

Removed

  • The Pyramid integration. Maintenance within the main package has become too much of a burden, so it is now lives in its own package called svcs-pyramid.

    Migrating is a pure rename: install svcs-pyramid, then replace import svcs with import svcs_pyramid and svcs.pyramid.foo() with svcs_pyramid.foo(). The registry and the container are still stored under the same keys, so nothing else changes. We will try to continue its maintenance for as long as its feasible.

    This is in line with our backwards-compatibility policy that has a provision for this exact case. #180

Added

  • FastAPI: svcs.fastapi.get_registry() returns the registry of a running application, either from the application object itself or from a test client wrapping it. The new svcs.fastapi.DepRegistry dependency (based on svcs.fastapi.registry()) injects it into views. #186

  • Starlette: svcs.starlette.get_registry() returns the registry of a running application, either from the application object itself or from a test client wrapping it. #186

Fixed

  • Autowiring now evaluates Python 3.14+ typing.ForwardRef annotations before service lookup. #187

Full Changelog →

Credits

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 a Font Awesome icon. svcs has started out as a wrapper around wired by Michael Merickel and has been heavily influenced by it.

svcs for Enterprise

Available as part of the Tidelift Subscription.

The maintainers of svcs and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.

Release files for svcs 26.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for svcs 26.2.0
File Size Uploaded
svcs-26.2.0.tar.gz 915.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for svcs 26.2.0
File Interpreter ABI Platform
svcs-26.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 937.5 kB

Release files / svcs-26.2.0.tar.gz

Download URL svcs-26.2.0.tar.gz
Size 915.2 kB
Tags Source
SHA-256 checksum
How to use checksums
129efb89586c2c52295ee00b00562af7d85d5535dad149534993e25fccbd76a6
BLAKE2b-256 checksum
How to use checksums
9b5e89463bf7613fe723801b8f7000f37c4c36486adcda0d115ca417e513c7cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release files / svcs-26.2.0-py3-none-any.whl

Download URL svcs-26.2.0-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1f074f345195b961fbf29af07f6ce181f7598813793773db20cf43870949c81
BLAKE2b-256 checksum
How to use checksums
307557ff9e594ee14d0948d3a77546894c5eb89616eeb7d8989962d6bcd1557b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page