-
Notifications
You must be signed in to change notification settings - Fork 5
Use get_app_model
instead of get_app
for napari>=0.5.4
#103
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
Conversation
@@ -7,7 +7,7 @@ | |||
from app_model.types import CommandRule, MenuItem | |||
|
|||
# TODO: This will be made public in some future napari version | |||
from napari._app_model import get_app | |||
from napari._app_model import get_app_model |
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.
If we use a try-except here, we will be compatible with older versions of napari, before the deprecation:
from napari._app_model import get_app_model | |
try: | |
from napari._app_model import get_app_model | |
except ImportError: | |
from napari._app_model import get_app as get_app_model |
@Czaki what do you think? Then I think we can just merge this and release?
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 prefer to use packaging and
from packaging.version import parse as parse_version
from importlib.metadata import version
if parse_version(version('napari')) >= parse_version('0.5.4'):
from napari._app_model import get_app_model
else:
from napari._app_model import get_app as get_app_model
It allows for simpler found code that may be dropped when dropping support of older napari releases.
Co-authored-by: Juan Nunez-Iglesias <[email protected]>
Co-authored-by: Grzegorz Bokota <[email protected]>
eded23b
to
4bf7497
Compare
@@ -137,6 +137,8 @@ def test_zoom_and_dimensions(): | |||
increase_dimensions_left(viewer) | |||
increase_dimensions_right(viewer) | |||
|
|||
viewer.close() |
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.
Maybe make_napari_viewer
fixture?
get_app_model
instead of get_app
get_app_model
instead of get_app
for napari>=0.5.4
Hi there, as part of napari/napari#6054 usage of
get_app
is being deprecated ( over PR napari/napari#7269 ). This PR changes things to useget_app_model
instead ofget_app
. It also bumps thenapari
version constraint to>=0.5.4