myfy Dependency Injection

•
83
•

Manages complex dependency life cycles and injection patterns within the myfy framework.

This skill provides deep domain knowledge for the myfy dependency injection system, enabling developers to build modular and testable Python applications. It covers the implementation of constructor-based DI across three distinct lifecycles: SINGLETON for shared resources, REQUEST for web contexts, and TASK for background workers. By applying this skill, developers can ensure strict architectural boundaries through compile-time scope validation, utilize qualifiers for ambiguous resolution, and implement advanced patterns like the Factory pattern to bridge different scope levels effectively.

Key Features

01Provider qualifiers for resolving multiple implementations of the same type
0283 GitHub stars
03Integrated testing support with dependency override context managers
04Lifecycle management for SINGLETON, REQUEST, and TASK scopes
05Automatic parameter classification for web routes and API endpoints
06Type-safe provider declarations using the @provider decorator

Use Cases

01Managing per-request state such as authentication sessions and request loggers
02Configuring shared database pools and caches as application-wide singletons
03Setting up isolated contexts for background processing and task execution