-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Automatic type resolver extraction from dataclasses #55
Comments
Yeah that sounds useful for sure. A couple things come to mind though.
This is cool stuff for sure, thanks for sharing. |
Thanks for the feedback @zeroSteiner , glad you find it useful! Let me just reply to your points one by one:
So what do you think, should I follow up with a PR? |
Created a sample implementation in #56 feel free to check it out, I ran the tests locally and they seem to work fine, also added a guard to tests the modern type hinting syntax ( |
Closing this since I'm pretty sure it was completed when I merged #56 and I just forgot about this ticket. |
Thanks @zeroSteiner for this amazing library, I am exploring it for a particular usecase. The type hinting feature is really important for my usecase and I want to detect the issues at compile time. My input is a python dataclass. Is it possible to build a general resolver like |
I think it should work based on my notes in this PR. If you have an example of what you're trying to do that's failing, I can look into it. |
I wold want to do something like
|
@akr31 I think the larger issue is that there isn't a way to define an object with attributes in Rule Engine. I've been meaning to add it recently because I've had my own use case that's very similar to what you're describing. After looking into this a bit more I don't think I ever fully added type resolvers for dataclasses. It looks like the PR I referenced only added support to I'd like to get this working but it might take me a while. I've reopened the ticket so I don't forget. I need to finish my current goal of adding a proper |
I was wondering if the project could benefit from an automatic type resolver extraction feature.
I have an example implementation that I created for my own use-case, but I found it quite generic, and I believe it might make sense to add it to the core library.
The type resolver implementation looks like this:
And to test it one can do:
It should produce a type resolver like the below:
Please tell me if you think it makes sense to add it to the lib and I can work it out more.
The text was updated successfully, but these errors were encountered: