Skip to content

Add dependency-injector Container Support

Choose a tag to compare

@vadikko2 vadikko2 released this 30 Oct 15:53
· 54 commits to master since this release
e205176
Add dependency-injector Container Support (#21)

* Add Dependency Injector CQRS Container and Update Configuration

- Introduced `DependencyInjectorCQRSContainer` to bridge dependency-injector with CQRS framework, enabling type-based dependency resolution.
- Updated `pyproject.toml` to include new dependencies: `dependency-injector` and `requests`.
- Enhanced `setup_mediator` and `bootstrap` functions to support both `di` and `ICQRSContainer` types.
- Added tests for the new container functionality, covering attachment, resolution strategies, and error handling.
- Updated `.gitignore` to exclude `uv.lock` file.

* Refactor Dependency Injector Logic in CQRS Container

- Replaced `isclass` import with `inspect` for improved clarity and consistency.
- Enhanced provider mapping to support both class-based and function-based providers, ensuring proper type resolution for return types.
- Streamlined the logic for checking provider attributes and their types.

* Update pyproject.toml and Add Dependency Injector Examples

- Updated version in `pyproject.toml` from 4.0.0 to 4.1.0.
- Added new examples demonstrating integration of `dependency-injector` with the CQRS framework, including practical and simple use cases.
- Enhanced `pyproject.toml` with additional dependencies.