-
Notifications
You must be signed in to change notification settings - Fork 30
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
Allow plugins to use settings utilities #513
Conversation
There are various settings utilities included in the `omeroweb.settings` module that would be useful to use in plugins. Unfortunately, because of import order and plugin settings processing that's made impossible if they are in the same package. The `LeaveUnset` functionality is of particular interest. This moves them into `omeroweb.utils` so they can be if desired.
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.
Was the issue that it wasn't possible to do from omeroweb.settings import LeaveUnset
because this affects the order that things are imported?
Changes look good and everything's green so 👍
Since
I was also finding myself re-implementing |
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.
Looking at the ecosystem of third-party OMERO.web apps available through GitHub, I definitely see a series of places where settings are declaring their own utility methods and some of the upstream OMERO.web logic could likely be re-used:
https://github.com/sukunis/OMERO.openlink/blob/db48a1f2e60f0dd099d87953aa55f93cd66575df/omero-openlink/omero_openlink/openlink_settings.py#L6-L10
https://github.com/jmuhlich/omero-oauth/blob/7cce1d48a6ab3ad0f3847d1cde4918feb129ce60/omero_oauth/oauth_settings.py#L16-L19
https://github.com/ome/omero-signup/blob/c8610dba25f39870a09fa5401c735fb3be85a319/omero_signup/signup_settings.py#L9-L13
Note in a few plugins, some of the methods migrated here seem to be imported directly
https://github.com/IDR/idr-gallery/blob/f96d66c6c99ff69de0c09be6cc97996f94397671/idr_gallery/gallery_settings.py#L23C1-L24
https://github.com/ome/omero-signup/blob/c8610dba25f39870a09fa5401c735fb3be85a319/omero_signup/signup_settings.py#L3C1-L3C1
This probably brings two questions:
- why are these plugins not having the circular dependency mentioned in Allow plugins to use settings utilities #513 (comment) ?
- removing these functions from
omeroweb.settings
will cause backwards incompatible changes for all plugins importing them. If this is a concern, a middle ground might be to move the logic toomeroweb.utils
as proposed but keep (and deprecate) and alias inomeroweb.settings
Because it's not strictly a circular dependency but rather the calling context during
No it will not as we're importing all the functions that were moved to |
Yes, none of these examples, including those from @sbesson above, utilize the built-in |
For completeness, @will-moore I found no OME web app using this settings layout. I assume as a proof of concept, it should be possible to update either |
There are various settings utilities included in the
omeroweb.settings
module that would be useful to use in plugins. Unfortunately, because of import order and plugin settings processing that's made impossible if they are in the same package. TheLeaveUnset
functionality is of particular interest. This moves them intoomeroweb.utils
so they can be if desired.