-
Notifications
You must be signed in to change notification settings - Fork 47
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
Implement singleton state and use it in the 2d annotator #240
Conversation
Hi @GenevieveBuckley , I have tested the annotator tools and they all still work as expected. |
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.
I keep coming back to this because I'm not sure I can make a meaningful review. Sorry!
This implementation looks like the metaclass singleton (as described here), so it seems like a reasonable approach. But I don't have enough expertise to really know if this is definitely the best implementation approach, or assess any of the discussion around singletons in python.
I'd like to say, let's just try it and see what breaks. The test coverage isn't great, so I'm not hugely confident that everything will go smoothly. But on the other hand, we need to move forward. So I think we should go ahead and accept that maybe some unexpected problems might pop up.
(The alternative is for me to pull this branch into my working branch, and check if singleton + embedding widget work well together. The disadvantage there is that multiple small PRs are usually quicker to get merged than one or two giant PRs).
Thanks for the review @GenevieveBuckley!
Yes, it follows the metaclass pattern. I don't use inheritance to have a separate implementation class that is not yet a singleton as in the example. I don't think it's needed for us, but it could be added later if required.
Ok, let's go ahead with it! Re test coverage: I have added two unit-tests for the state now. And for high-level / integration tests we will need to wait till the plugin structure takes more shape. I don't think it makes too much sense to add many tests for the current tool design, as this will change a bit to accommodate the plugins.
Yes, I also prepare having smaller PRs. |
Fixes #201