diff --git a/Changelog.md b/Changelog.md index e56a2279..d0a6bf81 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ # Changelog +## 0.8.5 () + +- `AsyncMachine.switch_model_context` is expected to be `async` now for easier integration of async code during model switch. + ## 0.8.4 (October 2020) Release 0.8.4 is a minor release and contains bugfixes as well as new features: diff --git a/README.md b/README.md index 0ab0023a..6bfefa12 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # transitions -[![Version](https://img.shields.io/badge/version-v0.8.4-orange.svg)](https://github.com/pytransitions/transitions) +[![Version](https://img.shields.io/badge/version-v0.8.5-orange.svg)](https://github.com/pytransitions/transitions) [![Build Status](https://travis-ci.org/pytransitions/transitions.svg?branch=master)](https://travis-ci.org/pytransitions/transitions) [![Coverage Status](https://coveralls.io/repos/pytransitions/transitions/badge.svg?branch=master&service=github)](https://coveralls.io/github/pytransitions/transitions?branch=master) [![PyPi](https://img.shields.io/pypi/v/transitions.svg)](https://pypi.org/project/transitions) -[![GitHub commits](https://img.shields.io/github/commits-since/pytransitions/transitions/0.8.3.svg)](https://github.com/pytransitions/transitions/compare/0.8.3...master) +[![GitHub commits](https://img.shields.io/github/commits-since/pytransitions/transitions/0.8.4.svg)](https://github.com/pytransitions/transitions/compare/0.8.4...master) [![License](https://img.shields.io/github/license/pytransitions/transitions.svg)](LICENSE) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pytransitions/transitions/master?filepath=examples%2FPlayground.ipynb) diff --git a/transitions/extensions/asyncio.py b/transitions/extensions/asyncio.py index 67d7acba..b4682dc7 100644 --- a/transitions/extensions/asyncio.py +++ b/transitions/extensions/asyncio.py @@ -120,7 +120,7 @@ async def execute(self, event_data): machine = event_data.machine # cancel running tasks since the transition will happen - machine.switch_model_context(event_data.model) + await machine.switch_model_context(event_data.model) await event_data.machine.callbacks(event_data.machine.before_state_change, event_data) await event_data.machine.callbacks(self.before, event_data) @@ -352,7 +352,7 @@ async def await_all(callables): """ return await asyncio.gather(*[func() for func in callables]) - def switch_model_context(self, model): + async def switch_model_context(self, model): """ This method is called by an `AsyncTransition` when all conditional tests have passed and the transition will happen. This requires already running tasks to be cancelled. diff --git a/transitions/version.py b/transitions/version.py index 3088fdf1..83fc6aee 100644 --- a/transitions/version.py +++ b/transitions/version.py @@ -2,4 +2,4 @@ to determine transitions's version during runtime. """ -__version__ = '0.8.4' +__version__ = '0.8.5'