You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you need to use any other object to persist the current state, or you're using the
5
+
state machine to control the flow of another object, you can pass this object
6
+
to the `StateMachine` constructor.
7
+
8
+
If you don't pass an explicit model instance, this simple `Model` will be used:
9
+
10
+
11
+
```{literalinclude} ../statemachine/model.py
12
+
:language: python
13
+
:linenos:
14
+
```
15
+
16
+
```{eval-rst}
17
+
.. autoclass:: statemachine.model.Model
18
+
:members:
19
+
```
20
+
21
+
```{seealso}
22
+
See the {ref}`sphx_glr_auto_examples_order_control_rich_model_machine.py` as example of using a domain object to hold attributes and methods to be used on the `StateMachine` definition.
23
+
```
24
+
25
+
```{hint}
26
+
Domain models are registered as {ref}`observers`, so you can have the same level of functionalities provided to the built-in `StateMachine`, such as implementing all callbacks and guards on your domain model and keeping only the definition of states and transitions on
Copy file name to clipboardExpand all lines: docs/releases/2.0.0.md
+90-11Lines changed: 90 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,11 @@
4
4
5
5
Welcome to StateMachine 2.0.0!
6
6
7
-
This version is the first to take advantage of the Python3 improvements. We're on our way to implementing features following the SCXML specs. We hope that you enjoy it.
7
+
This version is the first to take advantage of the Python3 improvements and is a huge internal refactoring removing the deprecated features on 1.*. We hope that you enjoy it.
8
8
9
9
These release notes cover the [](#whats-new-in-20), as well as
10
10
some [backwards incompatible changes](#backwards-incompatible-changes-in-20) you'll
11
-
want to be aware of when upgrading from StateMachine 1.*. We've
12
-
[begun the deprecation process for some features](#deprecated-features-in-20).
11
+
want to be aware of when upgrading from StateMachine 1.*.
13
12
14
13
15
14
## Python compatibility in 2.0
@@ -42,12 +41,12 @@ See {ref}`internal transition` for more details.
42
41
43
42
## Minor features in 2.0
44
43
45
-
- Modernization of the development stack to use linters.
44
+
- Modernization of the development tools to use linters and improved mypy support.
46
45
-[#342](https://github.com/fgmacedo/python-statemachine/pull/342): Guards now supports the
47
-
evaluation of **truthy**** and **falsy** values.
46
+
evaluation of **truthy** and **falsy** values.
48
47
-[#342](https://github.com/fgmacedo/python-statemachine/pull/342): Assignment of `Transition`
49
48
guards using decorators is now possible.
50
-
49
+
-[#331](https://github.com/fgmacedo/python-statemachine/pull/331): Added a way to generate diagrams using [QuickChart.io](https://quickchart.io) instead of GraphViz. See {ref}`diagrams` for more details.
51
50
52
51
## Bugfixes in 2.0
53
52
@@ -57,11 +56,91 @@ See {ref}`internal transition` for more details.
57
56
58
57
## Backward incompatible changes in 2.0
59
58
60
-
- TODO
61
-
### Other backward incompatible changes in 2.0
59
+
- Dropped support for Django <= `1.6` for auto-discovering and registering `StateMachine` classes
60
+
to be used on {ref}`django integration`.
61
+
62
+
### Statemachine class changes in 2.0
62
63
63
-
- TODO
64
+
#### `StateMachine.run` removed in favor of `StateMachine.send`
65
+
66
+
```py
67
+
from tests.examples.traffic_light_machine import TrafficLightMachine
0 commit comments