python-dispatch icon indicating copy to clipboard operation
python-dispatch copied to clipboard

Docs example proposal: emission locks, equal writes and unbind

Open PerchAnton opened this issue 1 month ago • 2 comments

I prepared a python-dispatch example that writes a native Property and records actual callbacks. Three traces show repeated equal values, coalescing under an emission lock, and property writes continuing after unbind. Each step keeps the value and notification history together so a report can distinguish mutation from delivery.

The example lives in an external development tool; python-dispatch would gain no runtime dependency.

Adapter · three traces · setup and scope · external PR #14.

Python 3.12, python-dispatch 0.2.3; 3 traces / 9 steps. Linux, Windows and macOS CI.

The JSON runner is my external interaction-check project. Upstream would gain no runtime dependency. Would a small link fit the Property or emission_lock documentation?

PerchAnton avatar Oct 26 '26 06:10 PerchAnton

@PerchAnton That's a very interesting concept. The results aren't immediately obvious to read though, especially without the context of what the expected log array is.

I wonder how much effort it would take to convert them into something like a mermaid sequence diagram so it'd be easier to display in documentation

Btw, you're doing some absolutely fantastic work out there!

nocarryr avatar Oct 27 '26 13:10 nocarryr

Thanks for the kind words! log is the cumulative list of values received by the callback, not all property writes. A small renderer for this adapter could show writes, callbacks and the final count, with separate expected and observed diagrams. Equal writes and emission locks can mean fewer callbacks than writes. This would be a new optional report feature: the current runner exports JSON/JUnit, not Mermaid. I have not implemented it or estimated the work yet.

PerchAnton avatar Oct 28 '26 06:10 PerchAnton