Skip to content

0.1.0

Choose a tag to compare

@g0di g0di released this 16 Jul 21:24
· 49 commits to main since this release

This version does a major change to the public API. Now Container is the main object to be used to register types in the container. To resolve, one must uses a ResolutionContext obtained by running open_context() function on the container. This produces a context allowing to resolves types and track entered context managers and cache objects.

Added

  • factory registry decorator now properly register generators decorated with the contextmanager decorator.
  • Added ability to override container dependencies at scope level using register_local() function.
  • Added a function self() to register a type and use it as its own factory

Removed

  • The Registry object

Changed

  • One must now use objects for lifetimes instead of literals, Singleton, Contextual, Transient.
  • Renamed to lookup the function to get a binding for a type
  • Changed the registration API which now use method chaining for registering either value, factory or alias.
  • Replaced Scope with ResolutionContext
  • close() method for Container and ResolutionContext has been renamed to release()

Internals

  • Registrations has now has a reference to the type to which it is binded
  • Extracted the context containaing cached resolved types and entered context managers into a dedicated object which is not tied to Container nor ResolutionContext directly.