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

♻️ REFACTOR: EntityExtrasMixin -> EntityExtras #5445

Merged
merged 5 commits into from
Apr 8, 2022

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Mar 15, 2022

Part of addressing #4976 and #5465

Similar to #5442, it moves the node/group extras methods to a separate "namespace", in a back compatible manner, and is another step towards #4976 (comment): removing another 10 methods on node (i.e. #5439 + #5442 + #5445, goes from 83 -> 48)

the following deprecations are made:

    _deprecated_extras_methods = {
        'attributes': 'all',
        'get_extra': 'get',
        'get_extra_many': 'get_many',
        'set_extra': 'set',
        'set_extra_many': 'set_many',
        'reset_extras': 'reset',
        'delete_extra': 'delete',
        'delete_extra_many': 'delete_many',
        'clear_extras': 'clear',
        'extras_items': 'items',
        'extras_keys': 'keys',
    }

e.g. Node.get_extra to Node.base.extras.get

To maintain parity, this PR also makes the same change to Group extras

@chrisjsewell chrisjsewell changed the title ♻️ REFACTOR: EntityExtrasMixin -> EntityExtras ♻️ REFACTOR: EntityExtrasMixin -> EntityExtras Mar 15, 2022
@chrisjsewell chrisjsewell force-pushed the orm-node-extras branch 2 times, most recently from 60c00f3 to e83c013 Compare March 22, 2022 01:17
@ramirezfranciscof ramirezfranciscof added this to the v2.0.0 milestone Apr 6, 2022
@chrisjsewell
Copy link
Member Author

@sphuber this is now rebased

Comment on lines +210 to +211
files_original = original_calc.base.repository.list_object_names()
files_cached = calc.base.repository.list_object_names()
Copy link
Contributor

Choose a reason for hiding this comment

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

This was apparently missed, but I don't think I saw the deprecation warning for this. Are those warnings working properly?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the warnings are probably not "activated" for these separate system tests. Obviously, just need to set the global variable (separate PR?)

Copy link
Contributor

Choose a reason for hiding this comment

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

Uhm, it seems like test_daemon.py is not being run at all anymore 😅 It accidentally got removed in 5d2f153 when the RPN workchains were moved to the nightly build. I will open a PR to reinstate them

aiida/orm/extras.py Outdated Show resolved Hide resolved
aiida/orm/groups.py Outdated Show resolved Hide resolved
@@ -109,7 +111,20 @@ def delete(self, pk: int) -> None:
self._backend.groups.delete(pk)


class Group(entities.Entity['BackendGroup'], entities.EntityExtrasMixin, metaclass=GroupMeta):
class GroupBase:
"""A namespace for group related functionality, that is not directly related to its user-facing properties."""
Copy link
Contributor

Choose a reason for hiding this comment

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

Still not sure about the "not directly related to its user-facing properties" because, if anything, the extras are exactly intended to be used by users. But it is just a docstring so not that important

aiida/orm/groups.py Outdated Show resolved Hide resolved
Co-authored-by: Sebastiaan Huber <[email protected]>
@chrisjsewell chrisjsewell requested a review from sphuber April 8, 2022 13:42
@sphuber
Copy link
Contributor

sphuber commented Apr 8, 2022

@chrisjsewell approved this so good to be merged. Would be good if you can have a look at #5468 and #5457

@chrisjsewell
Copy link
Member Author

I'm just out now, feel free to merge this with a suitable message.
Maybe look tomorrow

@sphuber sphuber merged commit d34c3ad into aiidateam:develop Apr 8, 2022
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