- Introduces a
ContainerProtocol to improve interoperability between
libraries and alternative implementations of DI containers. The protocol is
inspired by punq, since its code API
is the most user-friendly and intelligible of those that were reviewed.
The ContainerProtocol can be used through composition
to replace rodi with alternative implementations of dependency injection in
those libraries that use DI.
- Simplifies the code API of the library to support using the
Container class
to register and resolve services. The class Services is still used and
available, but it's no more necessary to use it directly.
- Replaces
setup.py with pyproject.toml.
- Renames context classes: "GetServiceContext" to "ActivationScope",
"ResolveContext" to "ResolutionContext".
- The "add_exact*" methods have been made private, to simplify the public API.
- Improves type annotations; MaximZayats' contribution.
- Adds typehints to GetServiceContext init params; guscardvs' contribution.
- Adds examples in a dedicated folder. Examples are tested.
⚠️ Contains breaking changes