HeadlinesBriefing favicon HeadlinesBriefing.com

dioxide v1.1.2 Adds Multi-Binding Support

DEV Community •
×

dioxide v1.1.2 introduces multi-binding support, allowing developers to register multiple adapters for the same port using the `multi=True` parameter on `@adapter.for_()`. This feature is particularly useful for plugin systems, where different plugins can be injected and executed in a specific order. For instance, a DataProcessor can now handle multiple plugins, such as a ValidationPlugin and a TransformPlugin, which are prioritized and executed accordingly.

The impact of this update is significant for mutation testing frameworks, which require collecting all mutation operators. With multi-binding, each operator is a decorated class that the container discovers during scanning. This makes it easier to manage and extend mutation testing capabilities without modifying the core engine. For example, ArithmeticOperator and ComparisonOperator can be added as mutation operators, enhancing the testing process.

This release also enhances the creation of ordered processing pipelines. The `priority` parameter controls the injection order, with lower values taking precedence. This feature is crucial for defining the sequence of operations in a pipeline, such as AuthenticationStep running before ValidationStep. Similarly, profile-filtered collections ensure that only relevant adapters are included based on the active profile, supporting different environments like PRODUCTION and TEST.

Looking ahead, developers can expect continued improvements in dioxide, focusing on enhancing plugin architectures and supporting more complex injection patterns. This update positions dioxide as a versatile tool for building extensible and maintainable systems.