Skip to content

refactor: ensure builtin settings classes are well named#4991

Open
mayankansys wants to merge 31 commits intomainfrom
refactor/builtin_settings_classes
Open

refactor: ensure builtin settings classes are well named#4991
mayankansys wants to merge 31 commits intomainfrom
refactor/builtin_settings_classes

Conversation

@mayankansys
Copy link
Collaborator

@mayankansys mayankansys commented Mar 12, 2026

Context

Builtin settings class names were not always clear.
For example, WriteCaseData is less readable than WriteCaseAndData.

Change Summary

  • Added naming overrides for clearer builtin class names.
  • Introduced ReadCaseAndData and WriteCaseAndData as preferred names.
  • Kept old names (ReadCaseData, WriteCaseData) as deprecated aliases with warnings.
  • Updated generated builtin settings outputs and related tests.

Rationale

This improves API readability without breaking existing user code. Users can migrate gradually while old names still work.

Impact

  • Affects solver builtin settings class naming and exports.
  • Backward compatibility is preserved through aliases.
  • Tests now validate both new preferred names and deprecated legacy names.

@github-actions github-actions bot added the enhancement Improve any current implemented feature label Mar 12, 2026
@mayankansys mayankansys linked an issue Mar 16, 2026 that may be closed by this pull request
@mayankansys mayankansys marked this pull request as ready for review March 16, 2026 09:43
Copilot AI review requested due to automatic review settings March 16, 2026 09:43
@mayankansys mayankansys marked this pull request as draft March 16, 2026 09:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors generated “builtin settings” command class names to be more explicit (ReadCaseAndData, WriteCaseAndData) while attempting to preserve backward compatibility via deprecated aliases (ReadCaseData, WriteCaseData).

Changes:

  • Add class name overrides in the builtin settings code generator and emit deprecated alias classes.
  • Update builtin settings tests to exercise the new names and assert deprecation warnings for legacy names.
  • Add changelog entries documenting the rename and deprecations.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/ansys/fluent/core/codegen/builtin_settingsgen.py Generates renamed command classes and deprecated aliases in the generated solver settings module.
tests/test_builtin_settings.py Updates tests to validate the new names and legacy aliases with warnings.
doc/changelog.d/4642.changed.md Documents the public-facing rename and deprecation behavior.
doc/changelog.d/4991.miscellaneous.md Adds a miscellaneous changelog note (contains a typo).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

mayankansys and others added 7 commits March 16, 2026 16:38
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>
@mayankansys mayankansys marked this pull request as ready for review March 17, 2026 07:17
Copilot AI review requested due to automatic review settings March 17, 2026 07:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the readability of generated solver builtin settings “command object” class names by introducing preferred ReadCaseAndData / WriteCaseAndData names while keeping ReadCaseData / WriteCaseData available as deprecated aliases.

Changes:

  • Added codegen-level naming overrides for specific builtin settings class names.
  • Updated generated builtin settings to export both the new preferred names and the legacy deprecated aliases, and to keep runtime mapping via _db_name.
  • Updated tests and changelog fragments to reflect the new preferred names and deprecation behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/ansys/fluent/core/codegen/builtin_settingsgen.py Adds class-name overrides and generates deprecated alias classes/exports for legacy names.
tests/test_builtin_settings.py Updates assertions to validate new preferred names and that legacy CamelCase aliases emit deprecation warnings.
doc/changelog.d/4991.miscellaneous.md Adds changelog fragment (contains a typo to fix).
doc/changelog.d/4642.changed.md Documents the new preferred names and legacy deprecated aliases.

💡 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>
Copilot AI review requested due to automatic review settings March 17, 2026 08:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the readability of generated solver builtin settings by introducing clearer public names for certain builtin command classes while preserving backward compatibility via deprecated aliases.

Changes:

  • Added class-name overrides so ReadCaseData/WriteCaseData are publicly exposed as ReadCaseAndData/WriteCaseAndData.
  • Generated deprecated aliases for legacy names (including exports via __all__) and added deprecation-warning behavior.
  • Updated builtin settings tests and added changelog fragments documenting the rename + deprecations.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/test_builtin_settings.py Updates assertions to use the new preferred names and verifies legacy CamelCase aliases emit deprecation warnings.
src/ansys/fluent/core/codegen/builtin_settingsgen.py Introduces name override mapping, switches _db_name to legacy DB names, exports both preferred + legacy names, and generates deprecated alias classes.
doc/changelog.d/4991.miscellaneous.md Adds a changelog entry about builtin settings naming.
doc/changelog.d/4642.changed.md Documents the new preferred names and deprecation of legacy names.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 20, 2026 09:14
@mayankansys mayankansys review requested due to automatic review settings March 20, 2026 09:14
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 25, 2026 05:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the generated builtin solver settings API to use clearer names for the “read/write case+data” commands while preserving backward compatibility via deprecated aliases.

Changes:

  • Added codegen-time class name overrides so ReadCaseData/WriteCaseData are now generated as ReadCaseAndData/WriteCaseAndData.
  • Generated deprecated aliases for legacy names (including warning emission) and updated __all__ accordingly.
  • Updated tests and changelog fragments to reflect the new preferred names and legacy deprecation behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/test_builtin_settings.py Updates assertions to prefer the new builtin class names and validates deprecation warnings for legacy aliases.
src/ansys/fluent/core/codegen/builtin_settingsgen.py Adds class name override mapping, updates generated _db_name mapping, and generates deprecated alias classes + __all__ entries.
doc/changelog.d/4991.miscellaneous.md Adds a Towncrier changelog fragment for the change.
doc/changelog.d/4642.changed.md Adds an additional Towncrier fragment describing the rename/deprecation behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 25, 2026 07:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 26, 2026 09:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 27, 2026 14:39
@mayankansys mayankansys enabled auto-merge (squash) March 27, 2026 14:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +352 to +363
read_case_and_data = globals()["ReadCaseAndData"]
write_case_and_data = globals()["WriteCaseAndData"]
assert ReadCase(settings_source=solver) == solver.file.read_case
assert ReadData(settings_source=solver) == solver.file.read_data
assert ReadCaseData(settings_source=solver) == solver.file.read_case_data
assert read_case_and_data(settings_source=solver) == solver.file.read_case_data
with pytest.warns(pyfluent.PyFluentDeprecationWarning, match="ReadCaseData"):
assert ReadCaseData(settings_source=solver) == solver.file.read_case_data
assert WriteCase(settings_source=solver) == solver.file.write_case
assert WriteData(settings_source=solver) == solver.file.write_data
assert WriteCaseData(settings_source=solver) == solver.file.write_case_data
assert write_case_and_data(settings_source=solver) == solver.file.write_case_data
with pytest.warns(pyfluent.PyFluentDeprecationWarning, match="WriteCaseData"):
assert WriteCaseData(settings_source=solver) == solver.file.write_case_data
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The test covers deprecation warnings for the legacy CamelCase names (ReadCaseData/WriteCaseData), but the generator also introduces deprecated snake_case aliases (read_case_data/write_case_data) via the command wrapper classes. Add assertions that calling these snake_case legacy aliases emits PyFluentDeprecationWarning and still maps to solver.file.read_case_data / solver.file.write_case_data so the full public API surface is validated.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improve any current implemented feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure "builtin" settings classes are well named

5 participants