Release: 2025-08-06
- Fix type annotations:
oop_ext.foundation.weak_ref.IsWeakProxy.oop_ext.foundation.weak_ref.IsWeakRef.oop_ext.foundation.weak_ref.GetWeakProxy.
Release: 2025-08-05
Broken Release
This version contains the incorrect patch -- nothing serious, just the master version instead of the expected patch.
Release: 2025-08-01
Broken Release
This version contains the incorrect patch -- nothing serious, just the master version instead of the expected patch.
Not released due to a problem during deploy.
Release: 2024-10-24
PriorityCallbacknow has type checking support, similar toCallback, with type checked variants:PriorityCallback0,PriorityCallback1, etc (#128).UnregisterContextis now public, meant to be used in type annotations.- Python 3.10+ is now required.
#48: New type-checker friendly
proxy = GetProxy(I, obj)function as an alternative toproxy = I(obj). The latter is not accepted by type checkers in general because interfaces are protocols, which can't be instantiated.Also fixed a type-checking error with
AsssertImplements:Only concrete class can be given where "Type[Interface]" is expected
This happens due to python/mypy#5374.
#47: Interfaces no longer check type annotations at all.
It was supported initially, but in practice this feature has shown up to be an impediment to adopting type annotations incrementally, as it discourages adding type annotations to improve existing interfaces, or annotating existing implementations without having to update the interface (and all other implementations by consequence).
It was decided to let the static type checker correctly deal with matching type annotations, as it can do so more accurately than
oop-extdid before.
#43: Fix support for type annotated
AttributeandReadOnlyAttribute:class IFoo(Interface): value: int = Attribute(int)
- #41: Fix regression introduced in
1.1.0where installing a callback usingcallback.Afterorcallback.Beforewould make a method no longer compliant with the signature required by its interface.
- #38: Reintroduce
extra_argsargument toCallback._GetKey, so subclasses can make use of it. - #36: Fix regression introduced in
1.1.0whereAbstractandImplementsdecorators could no longer be used in interfaces implementations.
#25:
oop-extnow includes inline type annotations and exposes them to user programs.If you are running a type checker such as mypy on your tests, you may start noticing type errors indicating incorrect usage. If you run into an error that you believe to be incorrect, please let us know in an issue.
The types were developed against
mypyversion 0.800.#26: New type-checked
Callbackvariants,Callback0,Callback1,Callback2, etc, providing type checking for all operations(calling,Register, etc) at nearly zero runtime cost.Example:
from oop_ext.foundation.callback import Callback2 def changed(x: int, v: float) -> None: ... on_changed = Callback2[int, float]() on_changed(10, 5.25)
Fixed
Callbacks.BeforeandCallbacks.Aftersignatures: previously their signature conveyed that they supported multiple callbacks, but it was a mistake which would break callers because every parameter after the 2nd would be considered thesender_as_parameterparameter, which was forwarded toAfterandBeforefunctions of the_shortcuts.pymodule.
Callbackscan be used as context manager, which provides aRegister(callback, function), which automatically unregisters all functions when the context manager ends.Callback.Register(function)now returns an object with aUnregister()method, which can be used to undo the register call.
- Change back the default value of
requires_declarationtoTrueand fix an error (#22) where the cache wasn't properly cleared.
- Fixes an issue (#20) where mocked classmethods weren't considered a valid method during internal checks.
- Add optional argument
requires_declarationso users can decide whether or not@ImplementsInterfacedeclarations are necessary.
- Implementations no longer need to explicitly declare that they declare an interface with
@ImplementsInterface: the check is done implicitly (and cached) by AssertImplements and equivalent functions.
- Interface and implementation methods can no longer contain mutable defaults, as this is considered a bad practice in general.
Nullinstances are now hashable.
Fix mismatching signatures when creating "interface stubs" for instances:
foo = IFoo(Foo())
- Interfaces now support keyword-only arguments.
- Remove
FunctionNotRegisteredErrorexception, which has not been in use for a few years.
- Fix issues of ignored exception on nested callback.
- Fix issues and remove obsolete code.
- First release on PyPI.