Skip to content
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

Add DeprecatedFIeld for more informative procedure for deprecating fields of artifacts #741

Merged
merged 5 commits into from
Apr 1, 2024

Conversation

dafnapension
Copy link
Collaborator

No description provided.

Copy link

codecov bot commented Mar 31, 2024

Codecov Report

Attention: Patch coverage is 91.89189% with 3 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@cd5ed5b). Click here to learn what that means.

Files Patch % Lines
src/unitxt/dataclass.py 86.66% 2 Missing ⚠️
src/unitxt/dict_utils.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #741   +/-   ##
=======================================
  Coverage        ?   91.13%           
=======================================
  Files           ?       98           
  Lines           ?     9897           
  Branches        ?        0           
=======================================
  Hits            ?     9020           
  Misses          ?      877           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dafnapension dafnapension force-pushed the farewell_to_fields branch 2 times, most recently from a1dc3a8 to 0ca8680 Compare March 31, 2024 17:11
Copy link
Member

@elronbandel elronbandel left a comment

Choose a reason for hiding this comment

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

This was quick. While doing the job I have two concerns:

  1. Seperation: so far dataclass was an independent module which does not know unitxt. It was done so to avoid circular imports and allow any unitxt module to use dataclass. I rather keep it that way if possible.
  2. Self-Contained Logic: Every class in unitxt should be self contained and understood from its definition. That way when someone read the code of class they can understand the way it works. Having the deprecation declared in the settings dis obey this principle.

If we don't find other way, this PR does answer the need for more informed field deprecation process.

My alternative suggestion is to create in the data class a new field type: DeprecatedField which will still be a viable field just produce a warning with a custom message given to the field constructor. That way both my concerns are addressed.

What do you think @dafnapension ?

…f code

Signed-off-by: dafnapension <dafnashein@yahoo.com>
Signed-off-by: dafnapension <dafnashein@yahoo.com>
@dafnapension
Copy link
Collaborator Author

I think that you are right as always, @elronbandel , and I respectfully accept your comment, and will implement!

Signed-off-by: dafnapension <dafnashein@yahoo.com>
@dafnapension
Copy link
Collaborator Author

dafnapension commented Apr 1, 2024

Hi @elronbandel , please see if my implementation gets any close to the elegant solution you had in mind.

Signed-off-by: dafnapension <dafnashein@yahoo.com>
@dafnapension
Copy link
Collaborator Author

Hi @elronbandel , please see my implementation per your metadata idea

@elronbandel elronbandel changed the title bid a warning farewell to deprecating fields Add DeprecatedFIeld for more inform precudre for deprecating fields of artifacts Apr 1, 2024
@elronbandel elronbandel enabled auto-merge (squash) April 1, 2024 13:48
@dafnapension dafnapension changed the title Add DeprecatedFIeld for more inform precudre for deprecating fields of artifacts Add DeprecatedFIeld for more informative procedure for deprecating fields of artifacts Apr 1, 2024
@elronbandel elronbandel merged commit ee4b467 into main Apr 1, 2024
8 checks passed
@elronbandel elronbandel deleted the farewell_to_fields branch April 8, 2024 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants