v0.159.0 Introduces changes how extension hooks are defined

This release changes how extension hooks are defined. The new style hooks are more flexible and allow to run code before and after the execution.

The old style hooks are still supported but will be removed in future releases.

How to upgrade

Before:

class MyExtension(Extension):
def on_executing_start(self): ...
def on_executing_end(self): ...

After

class MyExtension(Extension):
def on_execute(self):
# code before the execution starts
yield
# code after the execution ends

Migration guide

See the following table for a mapping between the old and new hooks.

Old hookNew hook
on_request_starton_operation
on_request_endon_operation
on_validation_starton_validate
on_validation_endon_validate
on_parsing_starton_parse
on_parsing_endon_parse
on_executing_starton_execute
on_executing_endon_execute