A lightweight, dependency injection container for Python 3.8+. Version 0.7.0 is the latest stable release. The library supports registering and resolving services, auto-registration, scoped containers, and singleton lifetimes. Release cadence is irregular.
pip install punqVerified import paths — ran on the pinned version, not inferred.
Create a container, register a string instance, and resolve it.
Use Python >=3.8.1 or pin punq to <=0.6.2.
Register all dependencies explicitly or use the `auto_register` feature (available in dev versions).
Upgrade to dev version or avoid using child().
Do not rely on auto-registration in production yet.
Run: pip install punq
Register the type before resolving: container.register(MyClass, MyClass())
Upgrade to the dev release with: pip install punq==0.8.0-dev1 or later.
Use: container.register(str, 'my string')
No dependency data recorded yet.