Skip to content

Refactor: Rename HasObservables to HasEmitters#3367

Merged
quaquel merged 1 commit intomesa:mainfrom
Nithurshen:refactor/rename-hasemitters
Feb 24, 2026
Merged

Refactor: Rename HasObservables to HasEmitters#3367
quaquel merged 1 commit intomesa:mainfrom
Nithurshen:refactor/rename-hasemitters

Conversation

@Nithurshen
Copy link
Copy Markdown
Contributor

Summary

This PR refactors the core reactive programming mixin in the experimental mesa_signals module by renaming HasObservables to HasEmitters. This terminology change makes the framework more precise, as the base class manages generic event emitters (via the @emit decorator) rather than just observable states.

Bug / Issue

Resolves the renaming task outlined in the Mesa Signals tracking issue: #3227

Implementation

  • mesa/experimental/mesa_signals/core.py: Renamed the HasObservables class to HasEmitters. Updated internal docstrings, type hints, and the __all__ export list.
  • mesa/experimental/mesa_signals/: Updated all internal imports and type hints across batching.py, observable_collections.py, and __init__.py.
  • mesa/model.py: Updated the core Model class definition to inherit from the newly named HasEmitters mixin.
  • tests/: Performed a global replacement of HasObservables to HasEmitters across the test suite to ensure all mock models and signal tests use the correct class.

Testing

Ran the entire test suite locally using pytest tests/.

  • All 402 tests passed successfully, including the specific test_mesa_signals.py and test_batching.py suites.
  • Verified that the renaming caused no import errors or broken dependencies.

Additional Notes

This PR addresses only the renaming bullet point from tracking issue #3227 to keep the diff clean and focused.

@github-actions
Copy link
Copy Markdown

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 +2.2% [+1.4%, +3.1%] 🔵 +1.7% [+1.3%, +2.0%]
BoltzmannWealth large 🔵 +1.3% [+0.5%, +2.1%] 🔵 +4.7% [+2.0%, +7.2%]
Schelling small 🔵 +0.7% [+0.6%, +0.8%] 🔵 +1.3% [+1.1%, +1.4%]
Schelling large 🔵 +1.6% [+1.0%, +2.1%] 🔵 +3.4% [+2.4%, +4.6%]
WolfSheep small 🔵 -0.1% [-0.2%, +0.0%] 🔵 +0.9% [+0.7%, +1.0%]
WolfSheep large 🔵 -1.3% [-2.1%, -0.4%] 🔵 -0.5% [-1.7%, +0.5%]
BoidFlockers small 🔵 -0.6% [-0.9%, -0.2%] 🔵 -1.7% [-1.9%, -1.5%]
BoidFlockers large 🔵 -0.1% [-0.4%, +0.2%] 🔵 -1.2% [-1.3%, -1.0%]

@quaquel quaquel added the breaking Release notes label label Feb 24, 2026
@quaquel quaquel marked this pull request as ready for review February 24, 2026 08:51
@quaquel
Copy link
Copy Markdown
Member

quaquel commented Feb 24, 2026

Was there a particular reason that this PR was still marked as Draft?

@github-actions
Copy link
Copy Markdown

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 -0.8% [-1.3%, -0.4%] 🔵 -0.8% [-1.0%, -0.5%]
BoltzmannWealth large 🔵 +0.1% [-0.5%, +0.7%] 🔵 -0.3% [-2.5%, +1.9%]
Schelling small 🔵 +0.8% [+0.6%, +1.1%] 🔵 +1.1% [+0.9%, +1.3%]
Schelling large 🔵 +0.1% [-0.9%, +0.8%] 🔵 +0.7% [-0.8%, +2.2%]
WolfSheep small 🔵 -0.4% [-0.5%, -0.2%] 🔵 +0.4% [+0.3%, +0.5%]
WolfSheep large 🔵 -1.1% [-1.7%, -0.6%] 🔵 -1.1% [-2.3%, -0.1%]
BoidFlockers small 🔵 -0.5% [-1.1%, +0.1%] 🔵 +0.4% [+0.2%, +0.5%]
BoidFlockers large 🔵 +0.2% [-0.7%, +0.9%] 🔵 +0.5% [+0.3%, +0.6%]

@Nithurshen
Copy link
Copy Markdown
Contributor Author

Nithurshen commented Feb 24, 2026

Was there a particular reason that this PR was still marked as Draft?

As I mentioned in the issue, I was waiting for a maintainer to confirm the refactor from HasObservable to HasEmitters.

@quaquel quaquel merged commit 5a1569e into mesa:main Feb 24, 2026
16 of 17 checks passed
@Nithurshen Nithurshen deleted the refactor/rename-hasemitters branch March 6, 2026 01:43
@EwoutH EwoutH added experimental Release notes label and removed breaking Release notes label labels Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

experimental Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants