Skip to content

Releases: illuin-tech/opyoid

3.0.0

25 Nov 19:07
a071bb4
Compare
Choose a tag to compare

Breaking changes

  • Remove support for Python 3.8

2.0.2

09 Jan 17:06
082b101
Compare
Choose a tag to compare

Fixes

  • Fixed an InjectException raised when trying to bind a class with a stringified parameter type

2.0.1

30 Dec 11:03
800c821
Compare
Choose a tag to compare

Fixes

  • Fixed MultiBindings not using the correct provider when having multiple ItemBindings to Providers

2.0.0

03 Nov 10:52
00c6178
Compare
Choose a tag to compare

Breaking changes

  • Remove support for Python < 3.8
  • MultiBindings now have the parameter override_bindings set to False by default (was True)

1.7.0

18 Nov 21:40
e554854
Compare
Choose a tag to compare

Features

  • Add official support for Python 3.11
  • Opyoid is now PEP561 compliant, and as such compatible with mypy
  • Added a Context Scope that can be used to control more precisely the scope of created objects:
from opyoid import ContextScope, Injector, SelfBinding

class MyClass:
  pass


injector = Injector(bindings=[SelfBinding(MyClass, scope=ContextScope)])
scope = injector.inject(ContextScope)

with scope:
    instance_1 = injector.inject(MyClass)
    instance_2 = injector.inject(MyClass)

with scope:
    instance_3 = injector.inject(MyClass)

assert instance_1 is instance_2
assert instance_1 is not instance_3

1.6.0

13 Sep 15:03
b2821d0
Compare
Choose a tag to compare

Features

  • Built-in types such as strings, ints, floats and booleans can be loaded from enviroment variables
    • The environment variable name should be <UPPER_CLASS_NAME_UPPER_PARAMTER_NAME>
    • Use InjectorOptions.use_env_vars to enable/disable the feature (activated by default)
    • Check the docs for more details

1.5.1

16 Jun 08:41
5b4bed2
Compare
Choose a tag to compare

Fixes

  • Fixed unwanted bindings being automatically created when using InstanceBindings with builtin types

1.5.0

30 May 15:16
026ec45
Compare
Choose a tag to compare

Features

  • Added named and scope parameters to item bindings, by default they keep the parent MultiBinding name and scope
    (as they did before)

1.4.0

27 May 09:25
73e690b
Compare
Choose a tag to compare

Features

  • Module classes can now be installed (instances can still be installed), the contained bindings will be created only
    once if the module class installed multiple times
  • Provider bindings can now bind any typed function as a provider, this is now the preferred way to create providers but
    provider classes are still supported

Fixed

  • Fixed missing bindings in log when adding item bindings to a previously existing multi binding

1.3.0

11 Apr 14:29
98c32a1
Compare
Choose a tag to compare

Features

  • Instances created from a class in a MultiBinding with a Singleton scope can now be reused
    • If you have a class A that requires List[B], a multibinding on B that binds subclasses B1 and B2,
      and another class C that requires B1, the same instance of B1 will be shared between A and the list in C