-
Notifications
You must be signed in to change notification settings - Fork 87
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
Codegen support for bool #1524
Codegen support for bool #1524
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1524 +/- ##
=========================================
+ Coverage 100.0% 100.0% +0.1%
=========================================
Files 228 228
Lines 15629 15658 +29
=========================================
+ Hits 15621 15650 +29
Misses 8 8
Continue to review full report at Codecov.
|
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.
@bchen1116 I think this is great! Thanks for making the fix. I left a couple of non-blocking comments about testing and handling non-json-serializable types.
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.
Looks good !
try: | ||
json.dumps(v) | ||
except TypeError: | ||
raise TypeError(f"Value {v} of type {type(v)} cannot be JSON-serialized") |
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.
@bchen1116 for what types does this error occur? Should we add test coverage of those cases?
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.
It errors out for lots of python-specific types. I can add more coverage of that in the tests
fix #1495
Add support for pythonic types that JSON doesn't normally support, like boolean and None values.
I didn't add in support/tests for Python objects (like Datetime) or tuples (which get converted to lists by
json.dumps
and remains a list afterjson.loads
) since these seem to be edge cases and are unlikely to be params in pipelines/pipeline hyperparameters. Certainly down to discuss this if it is otherwise important to have support for these/other cases!