Skip to content

Add SystemABC.bind method#179

Merged
pearsonca merged 1 commit intomainfrom
static_binding
Mar 10, 2026
Merged

Add SystemABC.bind method#179
pearsonca merged 1 commit intomainfrom
static_binding

Conversation

@pearsonca
Copy link
Copy Markdown
Member

@pearsonca pearsonca commented Mar 4, 2026

Added a way to "bind" parameters to a SystmABC which will return the
_stepper of said system wrapped in a partial of the given parameters.

  • Added private _checked_partial utility function as a thin wrapper
    around functools.partial but with custom validation.
  • Implemented SystemABC.bind which is itself a thin wrapper around
    _checked_partial.
  • Modified the "Implementing Custom Engines and Systems" documentation
    to include conceptual descriptions of systems/engines.

@pearsonca
Copy link
Copy Markdown
Member Author

n.b. this will supercede some work in #175

Comment thread src/flepimop2/_utils/_checked_partial.py
Comment thread src/flepimop2/_utils/_checked_partial.py Outdated
Comment thread src/flepimop2/_utils/_checked_partial.py Outdated
Comment thread src/flepimop2/system/abc/__init__.py Outdated
Comment thread src/flepimop2/system/wrapper/__init__.py
Comment thread tests/_utils/_checked_partial/test__checked_partial.py
Comment thread tests/_utils/test__checked_partial.py Outdated
Comment thread tests/system/test_system_bind.py
Comment thread src/flepimop2/_utils/_checked_partial.py Outdated
Comment thread src/flepimop2/_utils/_checked_partial.py
Copy link
Copy Markdown
Contributor

@jc-macdonald jc-macdonald left a comment

Choose a reason for hiding this comment

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

mostly looks good to me, did raise a couple of points.

@TimothyWillard
Copy link
Copy Markdown
Collaborator

Comment thread src/flepimop2/engine/abc/__init__.py
Copy link
Copy Markdown
Collaborator

@TimothyWillard TimothyWillard left a comment

Choose a reason for hiding this comment

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

Already reviewed most of the implementation previously so that's good. I would like this PR to be more focused though, seems like there are changes coming in that aren't relevant to the original goal here. I also have a preference for squashing these commits when merging, no reason for this single change to be split over 10+ commits.

Comment thread src/flepimop2/engine/abc/__init__.py
Comment thread CHANGELOG.md
Comment thread docs/development/implementing-custom-engines-and-systems.md Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This guide was originally designed to be more technical, and this looks like a lot of details about conceptual elements are being introduced. Maybe not necessarily in this PR, but I think there should be a new section in the documentation discussing model words vs representations vs implementations rather than inlining it with technical implementation. I also foresee having to add other conceptual elements in the future anyways so there will need to be a home for this I think.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

k - new PR? i think we need a place for the conceptual linkage somewhere, but open to where it goes.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

@jc-macdonald jc-macdonald left a comment

Choose a reason for hiding this comment

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

I agree with @TimothyWillard regarding separation of concerns/PR hygiene + squashing. Otherwise good

Added a way to "bind" parameters to a `SystmABC` which will return the
`_stepper` of said system wrapped in a partial of the given parameters.

- Added private `_checked_partial` utility function as a thin wrapper
  around `functools.partial` but with custom validation.
- Implemented `SystemABC.bind` which is itself a thin wrapper around
  `_checked_partial`.
- Modified the "Implementing Custom Engines and Systems" documentation
  to include conceptual descriptions of systems/engines.
@TimothyWillard TimothyWillard changed the title Introduce system binding Add SystemABC.bind method Mar 10, 2026
@TimothyWillard TimothyWillard self-assigned this Mar 10, 2026
@TimothyWillard
Copy link
Copy Markdown
Collaborator

@pearsonca I have squashed this PR into one commit as you requested.

@pearsonca pearsonca merged commit 0f8cfb3 into main Mar 10, 2026
7 checks passed
@pearsonca pearsonca deleted the static_binding branch March 10, 2026 20:12
TimothyWillard added a commit to ACCIDDA/flepimop2-demo that referenced this pull request Mar 16, 2026
Added missing `state_change` configuration to wrapper systems/engines.
Likely required following ACCIDDA/flepimop2#179.
TimothyWillard added a commit to ACCIDDA/flepimop2-demo that referenced this pull request Mar 16, 2026
Added missing `state_change` configuration to wrapper systems/engines.
Likely required following ACCIDDA/flepimop2#179. Helps to address #16,
but does not close it due to an issue with `op_engine`'s implementation,
see ACCIDDA/op_engine#15.
TimothyWillard added a commit to ACCIDDA/flepimop2-demo that referenced this pull request Mar 19, 2026
Added missing `state_change` configuration to wrapper systems/engines.
Likely required following ACCIDDA/flepimop2#179. Closes #16.
TimothyWillard added a commit to ACCIDDA/flepimop2-demo that referenced this pull request Mar 19, 2026
Added missing `state_change` configuration to wrapper systems/engines.
Likely required following ACCIDDA/flepimop2#179.

Closes #16.
TimothyWillard added a commit to ACCIDDA/flepimop2-demo that referenced this pull request Mar 19, 2026
Added missing `state_change` configuration to wrapper systems/engines.
Likely required following ACCIDDA/flepimop2#179.

Closes #16.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants