Skip to content

Document mesa_signals and add it to the API reference - #4190

Merged
quaquel merged 6 commits into
mesa:mainfrom
quaquel:docs/mesa-signals
Nov 25, 2026
Merged

quaquel merged 6 commits into
mesa:mainfrom
quaquel:docs/mesa-signals

Conversation

@quaquel

@quaquel quaquel commented Nov 23, 2026

Copy link
Copy Markdown
Member
  • Add a Signals section to the experimental API reference, listing the public API in reading order with a short introduction.
  • Observable: document that it signals on assignment only (changes made in place to a mutable value are not observed), that changes are detected with !=, how to set an initial value, and what subscribers receive; add an example.
  • HasEmitters, observe, observe_class: document that handlers are held by weak reference, so a lambda or local function is silently dropped unless kept alive elsewhere; document the accepted names and signal types, including ALL.
  • Message: document its fields.
  • computed_property: document lazy recomputation, the CHANGED signal on invalidation (with only old), and the cyclical dependency error.
  • BaseObservable: describe what an Observable is and fallback_value.
  • Run the doctests in core.py as part of the test suite.

Claude was used in creating this.

- Add a Signals section to the experimental API reference, listing the
  public API in reading order with a short introduction.
- Observable: document that it signals on assignment only (changes made
  in place to a mutable value are not observed), that changes are
  detected with !=, how to set an initial value, and what subscribers
  receive; add an example.
- HasEmitters, observe, observe_class: document that handlers are held
  by weak reference, so a lambda or local function is silently dropped
  unless kept alive elsewhere; document the accepted names and signal
  types, including ALL.
- Message: document its fields.
- computed_property: document lazy recomputation, the CHANGED signal on
  invalidation (with only old), and the cyclical dependency error.
- BaseObservable: describe what an Observable is and fallback_value.
- Run the doctests in core.py as part of the test suite.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RbrUQUQAArrpH7rYQFt6KW
@quaquel quaquel added the docs Release notes label label Nov 23, 2026
@github-actions github-actions Bot added experimental Release notes label testing Release notes label labels Nov 23, 2026
quaquel and others added 2 commits November 23, 2026 07:54
ObservableList no longer uses fallback_value as the old value of its
first assignment (mesa#3988), so the BaseObservable docstring now uses
ContinuousState, which uses it as its initial value, as the example.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RbrUQUQAArrpH7rYQFt6KW
Since mesa#4056, subscriptions survive deepcopy and pickle as far as their
handlers come along. Document this in the HasEmitters docstring, which
the API reference renders, including that a bound method stays
subscribed only if its object is copied along with the emitter.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RbrUQUQAArrpH7rYQFt6KW
@mesa-triage-bot

Copy link
Copy Markdown

Thanks for documenting signal behavior and adding an executable example.

@quaquel, related #4189 changes two behaviors documented here: reading before assignment and the first signal's old value when a fallback is supplied. Please keep those statements aligned when landing the two PRs; the wording here matches current main.

Automated note by an AI model; it can be wrong, and maintainers make the decisions. About this bot.

@EwoutH EwoutH left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clear docs, and nice that the example runs as a doctest.

Same note as on #4189: if that one lands first, the Observable docstring here should mention fallback_value (reading before assignment returns it, and it is the first old value) instead of saying reading always raises and old is always None.

@quaquel
quaquel merged commit 79b7bfb into mesa:main Nov 25, 2026
18 checks passed
@quaquel

quaquel commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

I fixed the docstring as suggested.

@quaquel
quaquel deleted the docs/mesa-signals branch December 1, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Release notes label experimental Release notes label testing Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants