Skip to content

Implement _bind_impl for SystemABC compliance#57

Merged
jc-macdonald merged 3 commits intomainfrom
feat/55-bind-impl
Apr 9, 2026
Merged

Implement _bind_impl for SystemABC compliance#57
jc-macdonald merged 3 commits intomainfrom
feat/55-bind-impl

Conversation

@jc-macdonald
Copy link
Copy Markdown
Collaborator

Implements _bind_impl() on the op_system provider, aligning with the SystemABC refactor landed in flepimop2 PR #182.

Changes

  • _bind_impl implementation — Uses functools.partial(self._stepper, **(params or {})) following the simple connector pattern from flepimop2's reference SIR system.
  • Imports updatedSystemProtocol, IdentifierString imported from flepimop2.typing; @override decorator with sys.version_info gate for 3.11 compat.
  • flepimop2 lockfile upgraded2f38ad0950296246 (post-PR #182).

Tests (5 new, 10 total)

Test What it exercises
test_bind_returns_system_protocol bind() returns a SystemProtocol-conformant callable
test_bind_with_static_params bind(params=...) partially applies parameters
test_bind_delegates_to_step bind() and step() produce identical results
test_bind_rejects_forbidden_param SystemABC.bind() rejects "time"/"state" keys
test_bind_roundtrip_multi_step Bound stepper works across repeated calls with population conservation

Related

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
@jc-macdonald jc-macdonald added provider flepimop2 provider/connector package refactor Code reorganization without behavior change testing Test infrastructure and coverage labels Apr 9, 2026
@jc-macdonald jc-macdonald added this to the Provider Integration milestone Apr 9, 2026
@pearsonca
Copy link
Copy Markdown
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?

@jc-macdonald
Copy link
Copy Markdown
Collaborator Author

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?

more a make it work to get through the demo change.

@jc-macdonald jc-macdonald merged commit 6045562 into main Apr 9, 2026
5 checks passed
@jc-macdonald jc-macdonald deleted the feat/55-bind-impl branch April 9, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

provider flepimop2 provider/connector package refactor Code reorganization without behavior change testing Test infrastructure and coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace system._stepper access with public bind API

3 participants