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

Remove pydantic dependency from MLI code #667

Merged
merged 4 commits into from
Aug 20, 2024

Conversation

AlyssaCote
Copy link
Contributor

@AlyssaCote AlyssaCote commented Aug 14, 2024

We only used pydantic BaseModels in FeatureStoreKey, so I converted that into a dataclass and used _post_init_ to validate that the key and descriptor are not empty strings. I also made the dataclass frozen.

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (mli-feature@391784c). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff               @@
##             mli-feature     #667   +/-   ##
==============================================
  Coverage               ?   81.46%           
==============================================
  Files                  ?       97           
  Lines                  ?     7665           
  Branches               ?        0           
==============================================
  Hits                   ?     6244           
  Misses                 ?     1421           
  Partials               ?        0           
Files with missing lines Coverage Δ
...m/_core/mli/infrastructure/storage/featurestore.py 100.00% <100.00%> (ø)
---- 🚨 Try these New Features:

@AlyssaCote AlyssaCote requested a review from ankona August 14, 2024 16:04
Copy link
Contributor

@mellis13 mellis13 left a comment

Choose a reason for hiding this comment

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

Just one question/comment. Thanks for the update!


from smartsim.log import get_logger

logger = get_logger(__name__)


class FeatureStoreKey(BaseModel):
@dataclass(frozen=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want frozen=True? I'm not familiar with the BaseModel -- is that frozen by default?

If frozen is not used, then I would assume that we need to add setter methods to check that any updates adhere to non-empty string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BaseModels are not frozen by default, but I think we definitely want a frozen dataclass because we don't want FeatureStoreKey instances to be updated.

Copy link
Contributor

@ankona ankona left a comment

Choose a reason for hiding this comment

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

LGTM

@AlyssaCote AlyssaCote merged commit f7ef49b into CrayLabs:mli-feature Aug 20, 2024
41 of 44 checks passed
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.

3 participants