Skip to content

Use __post_init__ in behavioral.Configuration #22

Description

@roygutg

The issue

Configuration has a _post_init method, which is called in from_dict before returning. This means that constructing a Configuration object without using that method (e.g., by calling the default constructor) skips all the crucial logic defined in _post_init.
This should be an extreme case, because using any contructors other than the ones provided in the API should be very uncomfortable for the user. Yet, it is a gap.

To mitigate that, we might utilize dataclass's built-in __post_init__.
The problem with that is a bug in dacite (which we're using for type safety and exception handling), effectively rendering __post_init__ useless when working with dacite. Read more in konradhalas/dacite#244.

The solution

Once the aforementioned bug in dacite is solved, we can easily adapt Configuration.py to work with __post_init__, based on the examples in the formal docs.
Note that this depends on the resolution of the dacite bug. Do not work on this issue before making sure that issue is solved.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions