-
Notifications
You must be signed in to change notification settings - Fork 76
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
Allow complete group encapsulation #1070
Allow complete group encapsulation #1070
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nikhilwoodruff for this contribution! 😃 This seems to address the point you opened yourself in #1041.
- For value assessment: @MaxGhenis, you upvoted Allow complete group encapsulation #1041, can you confirm this implementation would solve your concern as well? 🙂
- For vision compatibility assessment, @benjello and @sandcha, could you please comment on this minor extension of the API surface? Does it seem idiomatic enough in OpenFisca? Do you see good uses in the tax and benefit systems you maintain? 🙂
- For technical implementation: I see a good test suite. @maukoquiroga, @benjello do you have any feedback on the implementation? 🙂
On my side as a gatekeeper, my main feedback is on semver and CHANGELOG, as outlined in the comments 🙂 I would also add that some documentation on this new feature would be an important addition, to enable its discoverability. @maukoquiroga, considering #1061, would you recommend to use doctests or to use openfisca/openfisca-doc?
As soon as the version number and link are corrected, if I'm too long to review again, it is okay for another maintainer to dismiss my review if it is the only blocking point.
Blocking comments have been addressed :)
Thanks @nikhilwoodruff for your fast reaction! 😃
|
Fantastic work @nikhilwoodruff !
The test is an integration one which seems to cover the use case, I've just added a couple of suggestions.
I do recommend at least documenting the test itself, and the argument, I've made an example proposal. Other than that, for a real-life use-case scenario, I'd rather see it in openfisca/openfisca-doc —I hope both get merged soon, but for now, there :)
|
Thank you so much @maukoquiroga for your fast reaction and these very detailed suggestions 🤩 |
No, unfortunately it seems our CI config is not properly set up to handle incoming PRs from external organisations. The token needed to pass the CI coverage step is not passed to such PRs for security reasons, but the step is still run and thus fails instead of being cancelled. This is something to be fixed in #1057. |
@nikhilwoodruff @maukoquiroga @MattiSG : I am ok with the idea of introducing encapsulated entities. |
@benjello You mean when the |
Yes, this is great, thanks @nikhilwoodruff. Just wanted to check if this works for enums? I don't see one in the test. |
Just tried to get a MWE (I know we've had an issue in the past where projection loses the Enum decodability), but found it does work! Here's a MWE - I tested:
|
Nice, would those enum examples make sense to include as tests here? |
Definitely 😉 |
OK, added! |
Great ✨ !!! As soon as we deal with #1073 that failing check should go away. |
Coverage tests are not required, we should not wait for #1073 to merge this 🙂 |
Oh @MattiSG my mistake, I though coverage and test-docs were required.
Definitely.
It may, but anyway this needs to rebased before merging, so I'd rather fix that. |
doc: A full description. | ||
roles: The list of :class:`.Role` of the group entity. | ||
containing_entities: The list of keys of group entities whose | ||
members are guaranteed to be a superset of this group's entities. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @maukoquiroga for this fix for the doc tests - it seems that the code linter and the documentation parser have a contradictory requirement here? I'm having issues installing the dependencies for make test-doc
so I'm just running it on the GH actions (this last fix fixed the doc test, but broke the code lint check).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I saw that 😢
But @nikhilwoodruff you may just leave it as it is, either @MattiSG or I can fix this while rebasing for merging.
(Which we'll do sooner rather than later) 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still, I agree this is at best confusing, I wonder why there's a discrepancy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are using the Google Python Style you will sometimes get unwanted warnings from this plugin - particularly in the argument descriptions - as it does not use strict RST. We therefore currently suggest ignoring some of the violation codes:
[flake8]
extend-ignore =
# Google Python style is not RST until after processed by Napoleon
# See https://github.com/peterjc/flake8-rst-docstrings/issues/17
RST201,RST203,RST301,
Then I've just made |
@nikhilwoodruff I think we can just ignore the failing check, I'm rebasing and LGTM ✨ 💯 ! |
Co-authored-by: Matti Schneider <[email protected]>
Co-authored-by: Mauko Quiroga <[email protected]>
Co-authored-by: Mauko Quiroga <[email protected]>
acf9fff
to
acd2dff
Compare
Thanks @nikhilwoodruff for your reactivity and openness to feedback, it's great to have you as a new contributor! 😊 |
Hope this is useful - this fixes #1041 , by adding a shortcut to a containing group entity provided. I've added a test to
test_formulas
.Essentially, say we have three entities, person, family and household, and we know that all members of a family will be in the same household (but not necessarily vice-versa). Say we also have a variable
household_level_variable
at the household level, and we want to project the result of that variable to the contained families. Currently, I think we have to use:With this, we can instead use:
provided, that when we defined the family entity (using either
build_entity
or theEntity
class), we set the optional keyword argumentcontaining_entities = ["household"]
.