pepkit / peppy

Project metadata manager for PEPs in Python
https://pep.databio.org/peppy
BSD 2-Clause "Simplified" License
37 stars 13 forks source link

Built-In Method for Comparing two `peppy.Project` classes #379

Closed nleroy917 closed 2 years ago

nleroy917 commented 2 years ago

It would be nice to have a reliable way to compare two project classes. At present, a simple equals operator doesn't work:

import peppy
p1 = peppy.Project("example_peps-cfg2/example_basic/project_config.yaml")
p2 = peppy.Project("example_peps-cfg2/example_basic/project_config.yaml")
p1 == p2
>>> False

Maybe comparing the samples and ensuring they are identical in each project class?

This would be useful in tests for #378

khoroshevskyi commented 2 years ago

you should compare all the variables in the object, not just dicts, that were generated by to_dict(). Try to convert object variables using this function: https://github.com/pepkit/pephub_db/blob/648dfcb6d0dc15d8b758cbffc04839ae6cc303fd/peppy_p.py#L12-L48 and then compare it.

nleroy917 commented 2 years ago

Meeting on May 31st, 2022:

khoroshevskyi commented 2 years ago

fixed