Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Fix plugin things
Browse files Browse the repository at this point in the history
  • Loading branch information
willGraham01 committed Aug 29, 2023
1 parent f18f840 commit 29ebe79
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 33 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/plugin_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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/[email protected]
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test_include_guard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ name: Test Tensorflow include guards
on:
pull_request:
push:
branches: [main]
branches:
- main

jobs:
tensorflow_guards:
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -10,6 +11,7 @@ exclude CORE_CHANGELOG.md
exclude tox.ini

graft cellfinder
include cellfinder/napari.yaml

prune benchmarks
prune examples
Expand Down
18 changes: 9 additions & 9 deletions cellfinder/napari.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion examples/show_detection_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions tests/napari/test_curation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/napari/test_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/napari/test_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 1 addition & 13 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 29ebe79

Please sign in to comment.