From 29ebe798425251b207549d0e0715bd65ef469df4 Mon Sep 17 00:00:00 2001 From: willGraham01 <1willgraham@gmail.com> Date: Thu, 24 Aug 2023 14:50:34 +0100 Subject: [PATCH] Fix plugin things --- .github/workflows/plugin_preview.yml | 4 +--- .github/workflows/test_include_guard.yaml | 4 +++- MANIFEST.in | 2 ++ cellfinder/napari.yaml | 18 +++++++++--------- examples/show_detection_sample.py | 2 +- pyproject.toml | 7 +++++-- tests/napari/test_curation.py | 4 ++-- tests/napari/test_detection.py | 2 +- tests/napari/test_training.py | 2 +- tox.ini | 14 +------------- 10 files changed, 26 insertions(+), 33 deletions(-) diff --git a/.github/workflows/plugin_preview.yml b/.github/workflows/plugin_preview.yml index a0f43833..bfa67800 100644 --- a/.github/workflows/plugin_preview.yml +++ b/.github/workflows/plugin_preview.yml @@ -3,8 +3,6 @@ name: napari hub Preview Page # we use this name to find your preview page artif on: pull_request: - branches: - - '**' jobs: preview-page: @@ -13,7 +11,7 @@ jobs: steps: - name: Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: napari hub Preview Page Builder uses: chanzuckerberg/napari-hub-preview-action@v0.1 diff --git a/.github/workflows/test_include_guard.yaml b/.github/workflows/test_include_guard.yaml index ae64a1e5..26277d98 100644 --- a/.github/workflows/test_include_guard.yaml +++ b/.github/workflows/test_include_guard.yaml @@ -5,7 +5,8 @@ name: Test Tensorflow include guards on: pull_request: push: - branches: [main] + branches: + - main jobs: tensorflow_guards: @@ -32,6 +33,7 @@ jobs: fail-on-error: true script: | import cellfinder.core + import cellfinder.napari - name: Uninstall tensorflow run: python -m pip uninstall -y tensorflow diff --git a/MANIFEST.in b/MANIFEST.in index 145bfb8b..03f53bfb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,7 @@ include .napari/config.yml include LICENSE include README.md +include requirements.txt include CF-CORE-README.md include CF-NAPARI-README.md @@ -10,6 +11,7 @@ exclude CORE_CHANGELOG.md exclude tox.ini graft cellfinder +include cellfinder/napari.yaml prune benchmarks prune examples diff --git a/cellfinder/napari.yaml b/cellfinder/napari.yaml index 8a8485c3..27bacb2c 100644 --- a/cellfinder/napari.yaml +++ b/cellfinder/napari.yaml @@ -1,32 +1,32 @@ -name: cellfinder-napari +name: cellfinder schema_version: 0.1.0 contributions: commands: - - id: cellfinder-napari.detect_widget + - id: cellfinder.detect_widget title: Create Cell detection python_name: cellfinder.napari.detect:detect_widget - - id: cellfinder-napari.training_widget + - id: cellfinder.training_widget title: Create Train network python_name: cellfinder.napari.train:training_widget - - id: cellfinder-napari.CurationWidget + - id: cellfinder.CurationWidget title: Create Curation python_name: cellfinder.napari.curation:CurationWidget - - id: cellfinder-napari.SampleData + - id: cellfinder.SampleData title: Sample data python_name: cellfinder.napari.sample_data:load_sample widgets: - - command: cellfinder-napari.detect_widget + - command: cellfinder.detect_widget display_name: Cell detection - - command: cellfinder-napari.training_widget + - command: cellfinder.training_widget display_name: Train network - - command: cellfinder-napari.CurationWidget + - command: cellfinder.CurationWidget display_name: Curation sample_data: - key: sample display_name: Sample data - command: cellfinder-napari.SampleData + command: cellfinder.SampleData diff --git a/examples/show_detection_sample.py b/examples/show_detection_sample.py index d3195a53..3a44f7d1 100644 --- a/examples/show_detection_sample.py +++ b/examples/show_detection_sample.py @@ -14,7 +14,7 @@ viewer = napari.Viewer() # Open plugin viewer.window.add_plugin_dock_widget( - plugin_name="cellfinder-napari", widget_name="Cell detection" + plugin_name="cellfinder", widget_name="Cell detection" ) # Add sample data layers for layer in load_sample(): diff --git a/pyproject.toml b/pyproject.toml index 0c309fee..251e40ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,8 +65,8 @@ dev = [ "tox", ] -[project.entry-points.'napari.manifest'] -cellfinder-napari = "cellfinder.napari:napari.yaml" +[project.entry-points."napari.manifest"] +cellfinder = "cellfinder:napari.yaml" [project.scripts] cellfinder_download = "cellfinder.core.download.cli:main" @@ -97,6 +97,9 @@ known-first-party = ["cellfinder"] include-package-data = true py-modules = ["cellfinder"] +[tool.setuptools.package-data] +cellfinder = ["*.yaml", "*.png"] + [tool.setuptools_scm] [tool.cibuildwheel] diff --git a/tests/napari/test_curation.py b/tests/napari/test_curation.py index 9c06ee2f..f52141cc 100644 --- a/tests/napari/test_curation.py +++ b/tests/napari/test_curation.py @@ -19,7 +19,7 @@ def curation_widget(make_napari_viewer): """ viewer = make_napari_viewer() _, widget = viewer.window.add_plugin_dock_widget( - plugin_name="cellfinder-napari", widget_name="Curation" + plugin_name="cellfinder", widget_name="Curation" ) return widget @@ -103,7 +103,7 @@ def valid_curation_widget(make_napari_viewer) -> CurationWidget: num_dw = len(viewer.window._dock_widgets) _, curation_widget = viewer.window.add_plugin_dock_widget( - plugin_name="cellfinder-napari", widget_name="Curation" + plugin_name="cellfinder", widget_name="Curation" ) assert len(viewer.window._dock_widgets) == num_dw + 1 diff --git a/tests/napari/test_detection.py b/tests/napari/test_detection.py index fe59d04b..ea7c6fb5 100644 --- a/tests/napari/test_detection.py +++ b/tests/napari/test_detection.py @@ -21,7 +21,7 @@ def get_detect_widget(make_napari_viewer): for layer in load_sample(): viewer.add_layer(napari.layers.Image(layer[0], **layer[1])) _, widget = viewer.window.add_plugin_dock_widget( - plugin_name="cellfinder-napari", widget_name="Cell detection" + plugin_name="cellfinder", widget_name="Cell detection" ) return widget diff --git a/tests/napari/test_training.py b/tests/napari/test_training.py index 9ea85a4d..48ce1139 100644 --- a/tests/napari/test_training.py +++ b/tests/napari/test_training.py @@ -17,7 +17,7 @@ def get_training_widget(make_napari_viewer): viewer = make_napari_viewer() widget = training_widget() _, widget = viewer.window.add_plugin_dock_widget( - plugin_name="cellfinder-napari", widget_name="Train network" + plugin_name="cellfinder", widget_name="Train network" ) viewer.window.add_dock_widget(widget) return widget diff --git a/tox.ini b/tox.ini index 0ef04451..6d589ec3 100644 --- a/tox.ini +++ b/tox.ini @@ -15,27 +15,15 @@ commands = python -m pytest -v --color=yes deps = pytest pytest-cov - -[testenv:core] -description = Run core tests -commands = python -m pytest -v --color=yes tests/core -deps = pytest-lazy-fixture pytest-mock pytest-timeout -passenv = - NUMBA_DISABLE_JIT - -[testenv:napari] -description = Run napari plugin tests -commands = pytest -v --color=yes --cov=cellfinder --cov-report=xml tests/napari -deps = # Even though napari is a requirement for cellfinder-napari, we have to # ensure it is installed with the default Qt backend here. - qtpy napari[all] pytest-qt passenv = + NUMBA_DISABLE_JIT CI GITHUB_ACTIONS DISPLAY