Skip to content

FEAT: args deprecation decorator #6086

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

Merged
merged 12 commits into from
Apr 29, 2025
Merged

FEAT: args deprecation decorator #6086

merged 12 commits into from
Apr 29, 2025

Conversation

gmalinve
Copy link
Contributor

@gmalinve gmalinve commented Apr 28, 2025

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
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
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
Copy link
Contributor

@Alberto-DM Alberto-DM left a comment

Choose a reason for hiding this comment

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

Very nice! LGTM

@Alberto-DM
Copy link
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.

Copy link

codecov bot commented Apr 28, 2025

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.

Copy link
Collaborator

@SMoraisAnsys SMoraisAnsys left a comment

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 ?

@gmalinve
Copy link
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
Contributor Author

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

Copy link
Contributor

@Alberto-DM Alberto-DM left a comment

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.

@gmalinve gmalinve requested a review from Alberto-DM April 29, 2025 12:15
SMoraisAnsys
SMoraisAnsys previously approved these changes Apr 29, 2025
Copy link
Collaborator

@SMoraisAnsys SMoraisAnsys left a comment

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 !

@gmalinve gmalinve requested a review from SMoraisAnsys April 29, 2025 13:05
Copy link
Contributor

@Alberto-DM Alberto-DM left a comment

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 <[email protected]>
Co-authored-by: Sébastien Morais <[email protected]>
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