Skip to content

refactor: Deprecate direct value assignments for leaf nodes. - #5643

Open
prmukherj wants to merge 2 commits into
mainfrom
refactor/deprecate_direct_assignments
Open

prmukherj wants to merge 2 commits into
mainfrom
refactor/deprecate_direct_assignments

Conversation

@prmukherj

@prmukherj prmukherj commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Context

Direct assignment of values to the parameters could make us land into issues like:

x.y.z = < new state >

works but

z = <new state>

just ends up setting z to the object.

Change Summary

The = based direct assignment has been deprecated for all such settings and object model items and only setting state via set_state is recommended.

Rationale

To prevent issues and confusions like the ones mentioned in the issue and above.

Impact

Users to get a clear message and be advised to use the set_state for setting values.

@github-actions github-actions Bot added documentation Documentation related (improving, adding, etc) examples Publishing PyFluent examples labels Nov 21, 2026
@prmukherj prmukherj linked an issue Nov 21, 2026 that may be closed by this pull request
@github-actions github-actions Bot added the enhancement Improve any current implemented feature label Nov 21, 2026
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@@ -37,6 +37,6 @@ To assign the expression to a named expression in a live Fluent solver:
>>> # Assign to a named expression and evaluate
>>> # The expression is converted to string format: "AreaAve(AbsolutePressure,['inlet1'])"
>>> named = solver_session.settings.setup.named_expressions.create()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This will still work without any deprecation warning:

solver_session.settings.setup.named_expressions = {}

>>> # The expression is converted to string format: "AreaAve(AbsolutePressure,['inlet1'])"
>>> named = solver_session.settings.setup.named_expressions.create()
>>> named.definition = expr
>>> named.definition.set_state(expr)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

However after creation if we do this then we will get deprecation warning now.

@prmukherj
prmukherj marked this pull request as ready for review November 21, 2026 07:23
@prmukherj

Copy link
Copy Markdown
Collaborator Author

Apologies for the number of files changed in this PR but the actual changes are limited to only a few files, and the other files just contain the refactored syntaxes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation related (improving, adding, etc) enhancement Improve any current implemented feature examples Publishing PyFluent examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

State assignment via settings objects

2 participants