PySyringe
An opinionated dependency injection library for Python.
Keep your domain clean. Inject only at call sites.
$ pip install pysyringe
Zero-Decorator DI
Your domain classes stay free of framework annotations. Injection happens only at the infrastructure boundary.
Inference-Based Wiring
Auto-wire constructor dependencies from type hints. No registration boilerplate needed.
Thread-Safe by Design
Thread-local mocks, double-checked locking singletons, and per-thread instance caching built in.
Test-Friendly
Replace any dependency with a mock using context managers. Mocks never leak between threads.
Factory Support
Wire complex dependencies using factory methods. The container matches methods by return-type annotation.
Zero Dependencies
Pure Python. No external packages required. Works with Python 3.11+.