Implement _bind_impl for SystemABC compliance#57
Merged
jc-macdonald merged 3 commits intomainfrom Apr 9, 2026
Merged
Conversation
Implement the _bind_impl method required by flepimop2's SystemABC (introduced in flepimop2 PR #182). Uses functools.partial to wrap the compiled stepper with any static parameters, following the simple connector pattern used by flepimop2's reference SIR system. Closes #55 (partial — tests follow in subsequent commits)
Add three tests for the _bind_impl / bind() API: - test_bind_returns_system_protocol: verifies SystemProtocol compliance - test_bind_with_static_params: verifies partial application of params - test_bind_delegates_to_step: verifies bind() and step() produce identical results
Add two tests exercising the full bind() → _bind_impl() call chain through SystemABC's public API: - test_bind_rejects_forbidden_param: verifies _consolidate_args rejects 'time'/'state' keys per the SystemABC contract - test_bind_roundtrip_multi_step: verifies the bound stepper works across repeated calls (simulating an engine loop) with population conservation
Member
|
If this works as you desire, works for me. I was expecting a bit more re-organization, however? Is that in the works and this is just an minimal make-it-work change? |
TimothyWillard
approved these changes
Apr 9, 2026
Collaborator
Author
more a make it work to get through the demo change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements
_bind_impl()on the op_system provider, aligning with theSystemABCrefactor landed in flepimop2 PR #182.Changes
_bind_implimplementation — Usesfunctools.partial(self._stepper, **(params or {}))following the simple connector pattern from flepimop2's reference SIR system.SystemProtocol,IdentifierStringimported fromflepimop2.typing;@overridedecorator withsys.version_infogate for 3.11 compat.2f38ad09→50296246(post-PR #182).Tests (5 new, 10 total)
test_bind_returns_system_protocolbind()returns aSystemProtocol-conformant callabletest_bind_with_static_paramsbind(params=...)partially applies parameterstest_bind_delegates_to_stepbind()andstep()produce identical resultstest_bind_rejects_forbidden_paramSystemABC.bind()rejects"time"/"state"keystest_bind_roundtrip_multi_stepRelated
system._stepperaccess with public bind API #55system._stepperaccess with public bind API op_engine#49 (engine-sidesystem._stepper→system.bind())