Skip to content

Commit feafad4

Browse files
committed
docs: polish the 3.2.2 release notes and the pages they link to
Open the notes with a summary and a list of the behavior changes to check when upgrading, group the fixes by theme, and cite the issue and the PR of every entry. Add the missing entries for #650 and the GraphvizError exception change, the rejection of nested callbacks named like an event, and the events dropped after a top-level final state. Document Event(delay=..., internal=...) in the events page, the declared delay in the delayed events section, and the queue being discarded on termination in the processing model. Signed-off-by: Fernando Macedo <fgmacedo@gmail.com>
1 parent 38968c1 commit feafad4

5 files changed

Lines changed: 477 additions & 238 deletions

File tree

‎docs/diagram.md‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ The directive supports the same layout options as the standard `image` and
460460
`:target:` *(URL or empty)*
461461
: Makes the diagram clickable. When set without a value, the raw SVG is
462462
saved as a file and linked so users can open it in a new tab for
463-
full-resolution zooming — useful for large or complex diagrams.
463+
full-resolution zooming, useful for large or complex diagrams. The link is relative to
464+
the page, so it also works when the documentation is served below a URL prefix.
464465

465466
`:class:` *(space-separated strings)*
466467
: Extra CSS classes for the wrapper element.
@@ -486,6 +487,8 @@ JupyterLab cells — no extra code needed:
486487
![Approval machine on JupyterLab](images/lab_approval_machine_accepted.png)
487488

488489

490+
(diagram-graphviz-errors)=
491+
489492
## When Graphviz fails
490493

491494
Every path that runs `dot` (the `svg` format, `_repr_svg_()` in Jupyter, the command line
@@ -496,10 +499,11 @@ what Graphviz wrote to stderr, such as
496499
`Error: <stdin>: syntax error in line 25 near ','`. The Sphinx directive reports the same
497500
text as a build warning.
498501

499-
A missing program raises {class}`~statemachine.contrib.diagram.GraphvizNotFoundError`, a
500-
subclass of both `GraphvizError` and {class}`FileNotFoundError`. Catch `GraphvizError` to
501-
handle every case; code that skips diagrams with `except FileNotFoundError` when Graphviz is
502-
not installed keeps working:
502+
`GraphvizError` is a {class}`~statemachine.exceptions.StateMachineError`. A missing program
503+
raises {class}`~statemachine.contrib.diagram.GraphvizNotFoundError`, a subclass of both
504+
`GraphvizError` and {class}`FileNotFoundError`. Catch `GraphvizError` to handle every case;
505+
code that skips diagrams with `except FileNotFoundError` when Graphviz is not installed keeps
506+
working:
503507

504508
```py
505509
>>> from statemachine.contrib.diagram import GraphvizError

‎docs/events.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,28 @@ human-readable display name, use the `Event` class explicitly:
7171

7272
```
7373

74+
`Event` also takes a `delay`, in milliseconds, and `internal`. Both apply by default every
75+
time the event is triggered, and an explicit argument to `send()` overrides either one
76+
(`delay=0`, `internal=False`). A delayed event waits in the external queue until it is due (see
77+
{ref}`delayed-events`), and an internal event triggered from a callback runs within the
78+
current macrostep (see {ref}`processing model`). An event cannot be both delayed and
79+
internal: declaring it so raises {class}`~statemachine.exceptions.InvalidDefinition`.
80+
81+
```py
82+
>>> class Lantern(StateChart):
83+
... dark = State(initial=True)
84+
... lit = State(final=True)
85+
...
86+
... light = Event(dark.to(lit), delay=50)
87+
88+
>>> Lantern.light.delay
89+
50
90+
91+
```
92+
93+
Each of these forms also declares an event inside a `State.Compound` or `State.Parallel`
94+
body (see {ref}`compound-states`).
95+
7496

7597
(event-identity)=
7698

‎docs/processing_model.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ Within a single macrostep, the engine repeats:
7171
3. If neither step produced a transition, the macrostep is **done**.
7272

7373
After the macrostep completes, the engine picks the next event from the
74-
**external queue** (placed by `send()`) and starts a new macrostep.
74+
**external queue** (placed by `send()`) and starts a new macrostep. Once the
75+
machine reaches a top-level final state it stops, and the events left in the
76+
external queue are discarded.
7577

7678

7779
### Event queues

0 commit comments

Comments
 (0)