Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Force opencv-python-headless
run: |
pip uninstall -y opencv-python
pip install opencv-python-headless
pip install "numpy<2.0" opencv-python-headless
- name: Test with pytest
run: |
pytest -v --color=yes --cov=allencell_ml_segmenter --cov-report=xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_lint_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
strategy:
matrix:
os: [macos-latest, windows-latest]
python-version: ["3.9", "3.10"]
python-version: ["3.10"]
2 changes: 1 addition & 1 deletion .github/workflows/test_lint_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10"]
python-version: ["3.10"]
2 changes: 1 addition & 1 deletion docs/user_docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
project = "Segmenter ML Plugin for napari"
copyright = "2024, Allen Institute for Cell Science"
author = "Segmenter ML plugin team"
release = "1.0.0"
release = "1.0.1rc1"


# -- General configuration ---------------------------------------------------
Expand Down
13 changes: 6 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ build-backend = "setuptools.build_meta"
# https://peps.python.org/pep-0621/
[project]
name = "allencell-segmenter-ml"
version = "1.0.0"
version = "1.0.1rc1"
description = "A plugin to leverage ML segmentation in napari"
readme = "README.md"
requires-python = ">=3.9,<3.11"
requires-python = ">=3.10,<3.11"
license = { file = "LICENSE" }

classifiers = [
Expand All @@ -24,14 +24,13 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering :: Image Processing",
]

dependencies = [
"npe2>=0.6.2",
"numpy",
"numpy<2.0",
"hydra-core==1.3.2",
"bioio==1.1.0",
"bioio-base==1.0.4",
Expand All @@ -51,7 +50,7 @@ Documentation = "https://github.com/AllenCell/allencell-ml-segmenter#README.md"
# https://peps.python.org/pep-0621/#dependencies-optional-dependencies
[project.optional-dependencies]
napari = [
"napari>=0.4.18",
"napari>=0.6.2",
"pyqt5",
]

Expand All @@ -67,7 +66,7 @@ test_lint = [
"mypy",
"toml",
"bumpver",
"napari>=0.4.18",
"napari>=0.6.2",
"magicgui"
]

Expand Down Expand Up @@ -118,7 +117,7 @@ where = ["src"]

# https://pypi.org/project/bumpver
[tool.bumpver]
current_version = "1.0.0"
current_version = "1.0.1rc1"
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
commit_message = "Bump version {old_version} -> {new_version}"
commit = true
Expand Down
2 changes: 1 addition & 1 deletion src/allencell_ml_segmenter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.0.0"
__version__ = "1.0.1rc1"

from allencell_ml_segmenter.napari.napari_reader import napari_get_reader
from allencell_ml_segmenter.napari.sample_data import make_sample_data
Expand Down
22 changes: 21 additions & 1 deletion src/allencell_ml_segmenter/_tests/main/test_main_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from allencell_ml_segmenter.main.main_widget import MainWidget
from unittest.mock import Mock, patch
import napari
from napari.utils.events import EmitterGroup


# IMPORTANT NOTE: MainWidget is different from the other widgets since we do not directly
# instantiate it in our code. So, it will always receive a napari.Viewer object in
Expand All @@ -21,6 +23,20 @@
# but for now I'm just mocking it here.


class FakeLayers:
def __init__(self):
self.events = EmitterGroup(
source=self,
inserting=None,
inserted=None,
removing=None,
removed=None,
moving=None,
moved=None,
changed=None,
) # all napari layer events


@pytest.fixture
def main_widget(qtbot: QtBot) -> MainWidget:
"""
Expand Down Expand Up @@ -155,10 +171,14 @@ def test_experiments_home_initialized(qtbot: QtBot) -> None:
settings.set_user_experiments_path(
None
) # Simulates state where users has not yet chosen an experiments home.
viewer = Mock(
spec="napari.Viewer"
) # set up fake viewer with layers that can emit events
viewer.layers = FakeLayers()

# ACT
MainWidget(
Mock(spec=napari.Viewer), settings
viewer, settings
) # If the users settings does not find an experiments home path, it will prompt the user for one and persist it.

# ASSERT
Expand Down
7 changes: 6 additions & 1 deletion src/allencell_ml_segmenter/main/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ def get_layers_nonthreshold(self) -> list[Layer]:
def subscribe_layers_change_event(
self, function: Callable[[NapariEvent], None]
) -> None:
self.viewer.events.layers_change.connect(function)
# keeps layer list synced with the layer checkboxes in our plugin when
# items are added, removed, moved, or changed
self.viewer.layers.events.changed.connect(function)
self.viewer.layers.events.inserted.connect(function)
self.viewer.layers.events.removed.connect(function)
self.viewer.layers.events.moved.connect(function)

def _get_layer_by_name(self, name: str) -> Optional[Layer]:
layers: list[Layer] = self.get_layers()
Expand Down
Loading