Simple-injection

Latest version: v0.2.5

Safety actively analyzes 619494 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

0.2.5

Added a flag `auto_resolve` to the `ServiceCollection`. If true, services that have not been added to the collection will be added automatically when trying to resolve them.

0.2.4

* Improving error messages when a service fails to resolve. It will now inform you of the service that failed the resolution, and what dependencies it has that caused the error.
* Added support for optional arguments. Now if you have a class such as
python
class HasOptional:
def __init__(self, optional_dependency: Optional[Dependency] = None):
pass

and you request the service `HasOptional` from the collection, it will try to resolve it as `Dependency`. If `Dependency` has not been declared in the collection, it will use `None` instead.

0.2.3

* Improving some typing values
* Improving documentation

0.2.2

Mostly a documentation release
* Adding readme, improving documentation, and adding docs
* Changed behaviour when adding another service with same type. Will now use the last service added when requesting service from the collection.

0.2.1

Added ability to inject multiple services of same base type. When using the multiple services, simple use the typing `List[BaseService]` and each all implementations will be passed in order as a list.

0.2.0

The initial release for simple-injection

* Initial release includes transient, singleton and instance services.
* Support for resolving an defined service, and can resolve and run a function.

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.