feat: expr builder#5252
Conversation
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a new Fluent expression builder subsystem (AST + registry + parser + discovery + builder facade) and integrates it with the solver settings API so expression objects can be assigned directly to setup.named_expressions[...].definition. It also adds a comprehensive set of unit/grammar/discovery/integration tests plus a minimal Fluent smoke test.
Changes:
- Added
ansys.fluent.core.expressionspackage providing an AST, function registry, builder facade, discovery layer, and a recursive-descent parser with round-tripping. - Extended
Textual.set_state()to accept “expression objects” (duck-typed via__fluent_expr__) at whitelisted settings paths. - Added tests covering parsing, registry coverage, discovery via settings/field-info fakes, flobject integration, and a live Fluent smoke test.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/expressions/test_parser.py | Parser unit tests and canonical round-trip coverage. |
| tests/expressions/test_grammar.py | Grammar coverage tests for reductions/math/vector/conditional APIs. |
| tests/expressions/test_fluent_smoke.py | Live Fluent smoke test validating end-to-end builder→settings→evaluation. |
| tests/expressions/test_flobject_expression_integration.py | Offline tests for Textual.set_state expression-object acceptance/rejection by path. |
| tests/expressions/test_field_info_discovery.py | Tests for discovery behavior using field-info shaped fakes. |
| tests/expressions/test_expression_builder.py | Core builder/AST/registry behavior tests (rendering, operators, errors). |
| tests/expressions/test_discovery.py | Tests for settings-tree-driven discovery and slot accessors. |
| src/ansys/fluent/core/solver/flobject.py | Adds whitelisted-path expression-object support to Textual.set_state(). |
| src/ansys/fluent/core/expressions/errors.py | Introduces ExpressionBuildError. |
| src/ansys/fluent/core/expressions/builder.py | Implements ExpressionBuilder facade and group/signature invokers. |
| src/ansys/fluent/core/expressions/_slots.py | Adds per-parameter slot discovery helpers (locations/scalars). |
| src/ansys/fluent/core/expressions/_registry.py | Declares the function registry, signature/param binding, and Weight enum. |
| src/ansys/fluent/core/expressions/_parser.py | Implements tokenizer + recursive-descent parser + reverse maps for kind inference. |
| src/ansys/fluent/core/expressions/_discovery.py | Implements best-effort discovery against settings and/or field-info. |
| src/ansys/fluent/core/expressions/_ast.py | Adds the typed immutable AST and operator overloading. |
| src/ansys/fluent/core/expressions/init.py | Public package exports for builder/parser/types. |
| doc/changelog.d/5252.added.md | Changelog entry for the new expression builder feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…e remote formatting/additions
Pull request overview
This PR introduces a new Fluent expression builder subsystem (AST + registry + parser + discovery + builder facade) and integrates it with the solver settings API so expression objects can be assigned directly to
setup.named_expressions[...].definition. It also adds a comprehensive set of unit/grammar/discovery/integration tests plus a minimal Fluent smoke test.Changes:
ansys.fluent.core.expressionspackage providing an AST, function registry, builder facade, discovery layer, and a recursive-descent parser with round-tripping.Textual.set_state()to accept “expression objects” (duck-typed via__fluent_expr__) at whitelisted settings paths.