Skip to content

chore: Perform deprecation call from generated data. #4162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

prmukherj
Copy link
Collaborator

Perform deprecation call from generated data.

@github-actions github-actions bot added the enhancement Improve any current implemented feature label Jun 13, 2025
deprecated_class_version.update({cls_name: deprecated})
release_version = "20" + cls._deprecated_version.replace(".", "R")
r.write(f".. deprecated:: Ansys {release_version}\n\n")
deprecated_class_version.update({cls_name: release_version})
Copy link
Collaborator

Choose a reason for hiding this comment

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

@prmukherj
This function is getting increasingly complex and hard to follow, especially with the addition of edge-case handling like the if deprecated: block. A few concerns:

  • It’s now doing too much. We should consider decomposing it into smaller, well-named helper functions for clarity and testability.

  • The magic string logic for converting versions (e.g., replace(".", "R")) is brittle and obscure. This logic belongs in the FluentVersion class, where it can be centrally maintained and tested.

  • Some parts (e.g., cls_orig_name == "root" and hardcoded RST section generation) would benefit from explanatory comments.

  • As the doc generation grows, we need to ensure we’re not making the code harder for others (or future us) to safely maintain.

Could we take a moment to refactor this function as part of this PR, or otherwise track it for near-term cleanup?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I strongly agree with all your points and we had a discussion regarding this as well with @mkundu1. Actually it was an already existing code and as part of this PR we just moved it. There will be another part to this PR that will contain some refactoring changes, for which @mkundu1 has already created a task. I'll address this as well then.

Thank you for your suggestions.

"""Whether the object is deprecated in a specific Fluent version."""
deprecated_version = getattr(obj, "_deprecated_version", None)
return deprecated_version and (
float(deprecated_version) <= 22.2
Copy link
Collaborator

@seanpearsonuk seanpearsonuk Jun 16, 2025

Choose a reason for hiding this comment

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

@prmukherj Should this comparison go via the FluentVersion class? Is it possible? (It might require FluentVersion to be updated methinks.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, possible. Will do it.

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.

5 participants