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

BREAKING CHANGE: cleanup entities #1286

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

bonjourmauko
Copy link
Member

@bonjourmauko bonjourmauko commented Oct 25, 2024

New features

  • Add CoreEntity.variables
    • Allows for querying the variables defined for an entity.

Deprecations

  • Remove CoreEntity.check_role_validity
    • The method in itself had no relation to entities (it was a static
      method, so no depending neither on an entity class nor an instance). It
      could have been kept as a populations helper, where it was exclusively
      used. Nonetheless, check_role_validity had the peculiar behaviour of
      not failing but when the value of role is not None, that granted it
      in the author's opinion the right to be removed so as to avoid confusion.
  • Deprecate class_override arg from entities.build_entity
    • That argument actually did nothing, and linters have been complaining
      about this argument for almost 10 years now. It is only being marked as
      a breaking change for respect to the semantic versioning protocol.
  • Deprecate CoreEntity.check_variable_defined_for_entity
    • The feature is still provided by CoreEntity.get_variable when passed
      the optional positional or keyword argument check_existence. In fact,
      the removed method was duplicating and already existing behaviour.
  • Deprecate CoreEntity.set_tax_benefit_system
    • The feature is now provided by simple variable assignment:
      entity.tax_benefit_system = tax_benefit_system
    • Likewise, entity.tax_benefit_system becomes part of the public API
      (which implicitly it was as the private marker was being violated).

Technical changes

  • Fix failing openfisca-extension-template tests

The method in itself had no relation to `entities` (it was a static
method, so no depending neither on an entity class nor an instance). It
could have been kept as a `populations` helper, where it was exclusively
used. Nonetheless, `check_role_validity` had the peculiar behaviour of
not failing but when the value of `role` is not `None`, that granted it
in my opinion the right to be removed so as to avoid confusion.
…ity`

That argument actually did nothing, and linters have been complaining
about this argument for almost 10 years now. It is only being marked as
a breaking change for respect to the semantic versioning protocol.
The feature is now provided by simple variable assignment:

```python
entity.tax_benefit_system = tax_benefit_system
```

Likewise, `entity.tax_benefit_system` becomes part of the public API
(which implicitly it was as the private marker was being violated).
The feature is still provided by `CoreEntity.get_variable` when passed
the optional positional or keyword argument `check_existence`. In fact,
the removed method was duplicating and already existing behaviour.
@bonjourmauko bonjourmauko added the kind:refactor Refactoring and code cleanup label Oct 25, 2024
@bonjourmauko bonjourmauko requested review from a team October 25, 2024 18:40
@bonjourmauko bonjourmauko self-assigned this Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:refactor Refactoring and code cleanup
Projects
Development

Successfully merging this pull request may close these issues.

1 participant