-
Notifications
You must be signed in to change notification settings - Fork 9
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 Pydantic BaseModel instead of dataclass #74
Conversation
actually @JacksonMaxfield, if you have a moment to run your tests against this branch, that'd be helpful too. It shouldn't change anything externally... but would be nice to know that it doesn't affect your stuff before merging to master |
Hey @tlambert03 seems like there is a single change from current as a result of this! Seems that the # Create dimension order by getting the current scene's dimension order
# and reversing it because OME store order vs use order is :shrug:
dims = [d for d in scene_meta.pixels.dimension_order.value[::-1]] Simply dropping the # Create dimension order by getting the current scene's dimension order
# and reversing it because OME store order vs use order is :shrug:
dims = [d for d in scene_meta.pixels.dimension_order[::-1]] |
Thanks! That's very helpful. I think this has to do with the way the pedantic constrained string classes had a value attribute (instead of just acting like a string). This behavior actually seems more desirable! I'll check to see if it affects anything else |
Agree that this behavior seems more valuable! So no worries for me there! |
This may break some stuff for @toloudis. (re: your temporary OmeTiffWriter / metadata cleaner, I would just strict version pin ome-types until 4.x OmeTiffWriter is released) |
I’m also happy to try to make it backwards compatible here too if you want to point me to anything it breaks on your end @toloudis |
I'll have a chance to pull this branch and try it out tomorrow! Thanks for the heads-up. I think the dimension_order thing looks like an improvement. |
actually. @JacksonMaxfield and @toloudis, I haven't really seen any of the code where you use |
All of the 4.x code is on I don't have access to @toloudis code anymore unfortunately |
Specifically here is the OmeTiffReader: https://github.com/AllenCellModeling/aicsimageio/blob/main/aicsimageio/readers/ome_tiff_reader.py |
thanks! |
OK, so... I could make this compatible with your current tests by undoing just one line in this PR: setting Do you like all of the enum values to be raw A third option is to use an Enum subclass that provides a |
Yea on giving it some more thought I think having the raw Enum objects returned is probably the way to go? Idk I am on the fence too but I think I side in that direction. Simply because I like the explicitness of it all. Plus allowing the other enum options like name is cool too. |
great. I'm leaning that way too. It's easy to get the string from the enum, but hard to go the other way. will stick with that. That should mean this PR won't affect your stuff at all |
https://github.com/allen-cell-animated/cellbrowser-tools/ has been public for a while (arguably it shouldn't be yet, but oh well!) |
Thanks both, I've reverted the enum change back to the original behavior. so i think at this point it shouldn't change your tests. will merge tomorrow. feel free to keep suggesting changes to #77 if you'd like to ensure more things are tested on my end against aicsimageio |
I just released 0.2.4 without this change. Will merge now and when it releases it will be 0.3.0 |
This PR ports the autogen code over to use the pydantic
BaseModel
instead of the pydantic dataclass. The behavior is essentially the same (the two things are extremely similar in design and function), but this makes a number of things more straightforward, makes inheritance much easier (no funny business with non-default args following default args), and I hope this will make it easier to pull some of the stuff out of the autogen code and into some "real" python that we can lint/check etc...@jmuhlich, I know you're busy, but if you have a moment to let me know if you're terribly against this idea, that'd be great. Otherwise, I'll probably push forward with it.
(edit: I've taken the opportunity to clean up a number of other things here as well, fixes #66, and improves typing around ids, so this PR has unfortunately become a bit bloated)