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

Added deprecation warning to Transformation.dump/load; removed ExplicitMoleculeComponent.to_json/from_json #460

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dotsdl
Copy link
Member

@dotsdl dotsdl commented Jan 16, 2025

Closes #375, #458.

Also allows us to read GufeTokenizables serialized previously in
dict representation via .from_json.

Tips

  • Comment "pre-commit.ci autofix" to have pre-commit.ci atomically format your PR.
    Since this will create a commit, it is best to make this comment when you are finished with your work.

Checklist

  • Added a news entry

Developers certificate of origin

…itMoleculeComponent.to_json/from_json

Closes #375, #458.

Also allows us to read `GufeTokenizable`s serialized previously in
`dict` representation via `.from_json`.
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

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

Project coverage is 98.43%. Comparing base (f8baf7f) to head (2bad9b1).

Files with missing lines Patch % Lines
gufe/tokenization.py 60.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #460      +/-   ##
==========================================
- Coverage   98.52%   98.43%   -0.10%     
==========================================
  Files          39       39              
  Lines        2166     2168       +2     
==========================================
  Hits         2134     2134              
- Misses         32       34       +2     

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

@dotsdl dotsdl requested a review from atravitz January 17, 2025 00:33
@dotsdl
Copy link
Member Author

dotsdl commented Jan 17, 2025

I need to add an explicit test for the ability to load dict versions of GufeTokenizables.

Copy link
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

Very brief review - looks good to me but couple of comments.

deserialized = json.loads(content, cls=JSON_HANDLER.decoder)
try:
return cls.from_keyed_chain(keyed_chain=deserialized)
except:
Copy link
Member

Choose a reason for hiding this comment

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

Can we do a non-bare except here? I.e. is the error deterministic?

@@ -121,6 +121,10 @@ def dump(self, file):
file : Union[PathLike, FileLike]
A pathlike of filelike to save this transformation to.
"""
warnings.warn(
Copy link
Member

Choose a reason for hiding this comment

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

A nice to have here would be to add a test for these warnings.

Copy link
Contributor

@atravitz atravitz left a comment

Choose a reason for hiding this comment

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

I agree with @IAlibay on the tests and bare exception, nothing additional though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants