refactor: ensure builtin settings classes are well named#4991
refactor: ensure builtin settings classes are well named#4991mayankansys wants to merge 31 commits intomainfrom
Conversation
There was a problem hiding this comment.
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.
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>
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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/WriteCaseDataare publicly exposed asReadCaseAndData/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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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/WriteCaseDataare now generated asReadCaseAndData/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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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.
Context
Builtin settings class names were not always clear.
For example,
WriteCaseDatais less readable thanWriteCaseAndData.Change Summary
ReadCaseAndDataandWriteCaseAndDataas preferred names.(ReadCaseData, WriteCaseData)as deprecated aliases with warnings.Rationale
This improves API readability without breaking existing user code. Users can migrate gradually while old names still work.
Impact