Skip to content

Commit e87fb08

Browse files
Bump version (#1229)
* Bump version * Add napari plugin import tests
1 parent e70c251 commit e87fb08

3 files changed

Lines changed: 31 additions & 1 deletion

File tree

environment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dependencies:
1111
- pip
1212
- pooch
1313
- pyqt
14+
- python <3.14 # Note: napari <0.7 currently does not work on python 3.14. We will release this pin once we support napari 0.7.
1415
- python-xxhash
1516
- python-elf >=0.9
1617
# Note: installing the pytorch package from conda-forge will generally

micro_sam/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.8.1"
1+
__version__ = "1.8.2"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import importlib
2+
from pathlib import Path
3+
4+
import pytest
5+
import yaml
6+
7+
import micro_sam
8+
9+
10+
def _napari_command_python_names():
11+
"""Read all command 'python_name' targets from the napari plugin manifest."""
12+
manifest = Path(micro_sam.__file__).parent / "napari.yaml"
13+
spec = yaml.safe_load(manifest.read_text())
14+
return [command["python_name"] for command in spec["contributions"]["commands"]]
15+
16+
17+
@pytest.mark.parametrize("python_name", _napari_command_python_names())
18+
def test_napari_manifest_command_importable(python_name):
19+
"""Resolve each napari plugin command exactly as napari does when loading the plugin.
20+
21+
This catches import-time failures (e.g. a numpy ABI mismatch in a compiled transitive
22+
dependency such as 'edt') that otherwise only surface as a cryptic
23+
"RuntimeError: Failed to import command at '...:Annotator2d'" when opening the plugin
24+
in napari. We only resolve the command target (no widget instantiation), so this does
25+
not require a Qt event loop and runs as a non-GUI test.
26+
"""
27+
module_name, _, attr = python_name.partition(":")
28+
module = importlib.import_module(module_name)
29+
assert hasattr(module, attr), f"could not resolve napari command target '{python_name}'"

0 commit comments

Comments
 (0)