This release has a high expected feature, we're adding [asynchronous
support](../async.md), and enhancing overall functionality. In fact, the
approach we took was to go all the way down changing the internals of
the library to be fully async, keeping only the current external API as
a thin sync/async adapter.
StateMachine 2.3.0 supports Python 3.7, 3.8, 3.9, 3.10, 3.11 and 3.12.
We've fixed a bug on the package declaration that was preventing users
from Python 3.7 to install the latest version.
This release introduces native coroutine support using asyncio, enabling
seamless integration with asynchronous code.
Now you can send and await for events, and also write async
{ref}`Actions`, {ref}`Conditions` and {ref}`Validators`.
```{seealso}
See {ref}`sphx_glr_auto_examples_air_conditioner_machine.py` for an
example of
async code with a state machine.
```
```py
>>> class AsyncStateMachine(StateMachine):
... initial = State('Initial', initial=True)
... final = State('Final', final=True)
...
... advance = initial.to(final)
>>> async def run_sm():
... sm = AsyncStateMachine()
... await sm.advance()
... print(sm.current_state)
>>> asyncio.run(run_sm())
Final
```