Skip to content

Commit

Permalink
Remove napari_hook_implementation decorator (#36)
Browse files Browse the repository at this point in the history
* Remove napari-hook-implementation from get_writer

* Update python versions in setup.cfg

* Remove npe1 entrypoint

* fix test matrix

* Remove remaining uses of hookimpl decorator

* Update tox to match gha test matrix
  • Loading branch information
jni authored Jun 14, 2024
1 parent 2542e94 commit 5778489
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
9 changes: 1 addition & 8 deletions napari_svg/hook_implementations.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import numpy as np
from napari_plugin_engine import napari_hook_implementation
import warnings

from .xml_to_svg import xml_to_svg
Expand All @@ -16,7 +15,6 @@
supported_layers = ['image', 'points', 'labels', 'shapes', 'vectors']


@napari_hook_implementation(trylast=True)
def napari_get_writer(path, layer_types):
"""Write layer data to an svg.
Expand Down Expand Up @@ -66,7 +64,7 @@ def writer(path, layer_data):
path : str or None
If data is successfully written, return the ``path`` that was written.
Otherwise, if nothing was done, return ``None``.
"""
"""
ext = os.path.splitext(path)[1]
if ext == '':
path = path + '.svg'
Expand Down Expand Up @@ -112,7 +110,6 @@ def writer(path, layer_data):
return path


@napari_hook_implementation(trylast=True)
def napari_write_image(path, data, meta):
"""Write image data to an svg.
Expand Down Expand Up @@ -156,7 +153,6 @@ def napari_write_image(path, data, meta):



@napari_hook_implementation(trylast=True)
def napari_write_labels(path, data, meta):
"""Write labels data to an svg.
Expand Down Expand Up @@ -199,7 +195,6 @@ def napari_write_labels(path, data, meta):
return path


@napari_hook_implementation
def napari_write_points(path, data, meta):
"""Write points data to an svg.
Expand Down Expand Up @@ -242,7 +237,6 @@ def napari_write_points(path, data, meta):
return path


@napari_hook_implementation
def napari_write_shapes(path, data, meta):
"""Write shapes data to an svg.
Expand Down Expand Up @@ -284,7 +278,6 @@ def napari_write_shapes(path, data, meta):
return path


@napari_hook_implementation
def napari_write_vectors(path, data, meta):
"""Write vectors data to an svg.
Expand Down
9 changes: 4 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ classifiers =
Topic :: Software Development :: Testing
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Operating System :: OS Independent
License :: OSI Approved :: BSD License

[options]
zip_safe = False
packages = find:
python_requires = >=3.8
python_requires = >=3.9
install_requires =
imageio>=2.5.0
numpy>=1.16.0
Expand All @@ -40,8 +41,6 @@ testing =
pyqt5

[options.entry_points]
napari.plugin =
svg = napari_svg
napari.manifest =
napari-svg = napari_svg:napari.yaml

Expand Down
8 changes: 3 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# For more information about tox, see https://tox.readthedocs.io/en/latest/
[tox]
envlist = py{38,39,310,py311}-{linux,macos,windows}
envlist = py{39,py312}-{linux,macos,windows}

[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.12: py312

[gh-actions:env]
PLATFORM =
ubuntu-latest: linux
Expand Down

0 comments on commit 5778489

Please sign in to comment.