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

Use __post_init__ in behavioral.Configuration #22

Open
roygutg opened this issue Sep 11, 2024 · 0 comments
Open

Use __post_init__ in behavioral.Configuration #22

roygutg opened this issue Sep 11, 2024 · 0 comments

Comments

@roygutg
Copy link
Collaborator

roygutg commented Sep 11, 2024

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.

@roygutg roygutg mentioned this issue Sep 11, 2024
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

No branches or pull requests

1 participant