Skip to content

FEAT: args deprecation decorator#6086

Merged
gmalinve merged 12 commits into
mainfrom
feat/deprecate_args
Apr 29, 2025
Merged

FEAT: args deprecation decorator#6086
gmalinve merged 12 commits into
mainfrom
feat/deprecate_args

Conversation

@gmalinve

@gmalinve gmalinve commented Apr 28, 2025

Copy link
Copy Markdown
Contributor

Description

In this PR I created a new decorator to deprecate arguments (whether they are positional or keywords) that will be removed in future versions. In this specific case I removed all analyze argument. We want to remove the possibility of analyzing the project within another method.

Issue linked

Please mention the issue number or describe the problem this pull request addresses.

Checklist

  • I have tested my changes locally.
  • I have added necessary documentation or updated existing documentation.
  • I have followed the coding style guidelines of this project.
  • I have added appropriate tests (unit, integration, system).
  • I have reviewed my changes before submitting this pull request.
  • I have linked the issue or issues that are solved by the PR if any.
  • I have agreed with the Contributor License Agreement (CLA).

@ansys-reviewer-bot

Copy link
Copy Markdown
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@gmalinve

Copy link
Copy Markdown
Contributor Author

@SMoraisAnsys @Samuelopez-ansys @Alberto-DM maybe we could think of merging the deprecate_kwargs with this new decorator?

@github-actions github-actions Bot added the enhancement New features or code improvements label Apr 28, 2025

@Alberto-DM Alberto-DM left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Very nice! LGTM

Comment thread src/ansys/aedt/core/application/analysis.py
@Alberto-DM

Copy link
Copy Markdown
Contributor

@SMoraisAnsys @Samuelopez-ansys @Alberto-DM maybe we could think of merging the deprecate_kwargs with this new decorator?

I would keep them separated for clarity. One to remove arguments and one to modify their names.

@codecov

codecov Bot commented Apr 28, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 87.87879% with 4 lines in your changes missing coverage. Please review.

Project coverage is 85.15%. Comparing base (4432400) to head (bc77933).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6086   +/-   ##
=======================================
  Coverage   85.15%   85.15%           
=======================================
  Files         167      167           
  Lines       63124    63153   +29     
=======================================
+ Hits        53754    53780   +26     
- Misses       9370     9373    +3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@SMoraisAnsys SMoraisAnsys left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I really like the idea behind this decorator and agree with @Alberto-DM, we should distinguish both decorators.

I've though a bit of the use cases we could face and I think it could be a good idea to customize the decorator a bit more. Here are some behavior we might want to add in order to pass information to our user:

  • since: version where the argument was deprecated or deleted
  • removed: states whether the argument was deleted or is just deprecated ftm
  • custom_message: override the message that could be generated with other options
  • action: raise a warning / raise an exception
  • warning_category: type of warning to use (DeprecationWarning, FutureWarning)

What do you think ?

Comment thread src/ansys/aedt/core/application/analysis.py Outdated
@gmalinve

Copy link
Copy Markdown
Contributor Author

@SMoraisAnsys yes, I agree.
I do have a question regarding this specific case of the analyze argument.
If we put since how do I know when this will be deprecated? I guess, in general, this kind of deprecations are going to be removed in v1.0. Am I wrong?
The custom_message is already implemented and if not provided the default message will be displayed.

@gmalinve

Copy link
Copy Markdown
Contributor Author

@SMoraisAnsys I added version and removed. What do you think?
@Samuelopez-ansys

@Alberto-DM Alberto-DM left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You have added version as a mandatory argument. You need to adjust the decorators calls.

Comment thread src/ansys/aedt/core/generic/general_methods.py Outdated
Comment thread src/ansys/aedt/core/generic/general_methods.py Outdated
Comment thread src/ansys/aedt/core/generic/general_methods.py Outdated
@gmalinve gmalinve requested a review from Alberto-DM April 29, 2025 12:15
SMoraisAnsys
SMoraisAnsys previously approved these changes Apr 29, 2025

@SMoraisAnsys SMoraisAnsys left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, I left a minor comment to make the message more consistent and handle multiple situations (with or without version provided).
Thanks for the changes !

Comment thread src/ansys/aedt/core/generic/general_methods.py
Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com>
@gmalinve gmalinve requested a review from SMoraisAnsys April 29, 2025 13:05

@Alberto-DM Alberto-DM left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@gmalinve gmalinve merged commit d48283a into main Apr 29, 2025
31 checks passed
@gmalinve gmalinve deleted the feat/deprecate_args branch April 29, 2025 17:04
nunesanderson pushed a commit that referenced this pull request Apr 30, 2025
Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com>
Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New features or code improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deprecate all methods that wrap analyze() or analyze_setup()

5 participants