Wire operators and operator_axis options in provider (#8, #54)#62
Merged
jc-macdonald merged 2 commits intomainfrom Apr 13, 2026
Merged
Wire operators and operator_axis options in provider (#8, #54)#62jc-macdonald merged 2 commits intomainfrom
jc-macdonald merged 2 commits intomainfrom
Conversation
Equation keys like "u[x, y]" failed validation because template expansion produces "u[x,y]" (no spaces). Normalize equation key bracket contents at entry to match template form. Note: this helper is intentionally minimal — broader parsing consolidation is tracked in #30 and the Pydantic-ify milestone (#22, #28).
Extract operator metadata from compiled spec and expose via SystemABC.option(): - operators: tuple of immutable MappingProxy dicts (or None) - operator_axis: shared axis name when all operators act on one axis Operator data is stored as immutable MappingProxyType objects to prevent callers from accidentally mutating spec metadata.
4a3bef5 to
756b3dc
Compare
TimothyWillard
approved these changes
Apr 13, 2026
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.
Summary
Expose operator metadata through
SystemABC.option()so downstream engines (e.g.,op_engine) can discover IMEX operator configuration without re-parsing the spec. Also fixes a bug where whitespace in template equation keys caused false validation errors.Changes
Bug fix —
specs.pywhitespace normalisation (01cbe8e)Equation keys written with spaces inside brackets (e.g.,
"u[x, y]") failed validation because_expand_state_templatesbuilds canonical keys without spaces ("u[x,y]"). Added_normalize_bracket_keyto strip whitespace inside brackets at equation-map entry, using the existing_STATE_TEMPLATE_REregex. Tested with 2-axis and 3-axis cases.Feature — operator wiring (
4a3bef5)Two new static methods on
OpSystemSystem:_extract_operators→ returnstuple[MappingProxyType, ...] | Nonefromcompiled.meta["operators"]_extract_operator_axis→ returns the shared axis name (str) when all operators act on one axis, otherwiseNoneWired into
model_post_initalongside the existingmixing_kernels:Operator dicts are stored as
MappingProxyTypeto prevent callers from accidentally mutating spec metadata.Tests added
option()MappingProxyTyperejects mutation)mixing_kernelsCloses
operatorsandoperator_axisoptions in provider #54Related
_normalize_bracket_keywill be absorbed when parsing is consolidatedExpressionStringtype #22, AddOperatorPydantic model #28 (Pydantic-ify milestone) — structured models will replace ad-hoc dict parsing