Skip to content

Commit

Permalink
updated to npe2
Browse files Browse the repository at this point in the history
  • Loading branch information
gatoniel committed Nov 21, 2023
1 parent 36e5afd commit 3bdd307
Show file tree
Hide file tree
Showing 12 changed files with 197 additions and 188 deletions.
43 changes: 19 additions & 24 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

name: tests

on:
on:
push:
branches:
- main
- main
- npe2
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches:
- main
- main
- npe2
workflow_dispatch:

jobs:
Expand All @@ -23,30 +23,24 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.7, 3.8, 3.9]
python-version: ['3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

# these libraries, along with pytest-xvfb (added in the `deps` in tox.ini),
# enable testing on Qt on linux
- name: Install Linux libraries
if: runner.os == 'Linux'
run: |
sudo apt-get install -y libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 \
libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0
# these libraries enable testing on Qt on linux
- uses: tlambert03/setup-qt-libs@v1

# strategy borrowed from vispy for installing opengl libs on windows
- name: Install Windows OpenGL
if: runner.os == 'Windows'
run: |
git clone --depth 1 git://github.com/pyvista/gl-ci-helpers.git
git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git
powershell gl-ci-helpers/appveyor/install_opengl.ps1
# note: if you need dependencies from conda, considering using
Expand All @@ -56,40 +50,41 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools tox tox-gh-actions
python -m pip install setuptools tox tox-gh-actions
# this runs the platform-specific tests declared in tox.ini
- name: Test with tox
run: tox
uses: aganders3/headless-gui@v1
with:
run: python -m tox
env:
PLATFORM: ${{ matrix.platform }}

- name: Coverage
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3

deploy:
# this will run when you have tagged a commit, starting with "v*"
# and requires that you have put your twine API key in your
# and requires that you have put your twine API key in your
# github secrets (see readme for details)
# needs: [test]
runs-on: ubuntu-latest
if: contains(github.ref, 'tags')
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools setuptools_scm wheel twine
pip install -U setuptools setuptools_scm wheel twine build
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
run: |
git tag
python setup.py sdist bdist_wheel
python -m build .
twine upload dist/*
9 changes: 9 additions & 0 deletions .napari-hub/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- This file is a placeholder for customizing description of your plugin
on the napari hub if you wish. The readme file will be used by default if
you wish not to do any customization for the napari hub listing.
If you need some help writing a good description, check out our
[guide](https://github.com/chanzuckerberg/napari-hub/wiki/Writing-the-Perfect-Description-for-your-Plugin)
-->

The developer has not yet provided a napari-hub specific description.
92 changes: 0 additions & 92 deletions .napari/DESCRIPTION.md

This file was deleted.

1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include LICENSE
include README.md
include requirements.txt

recursive-exclude * __pycache__
recursive-exclude * *.py[co]
58 changes: 58 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[build-system]
requires = ["setuptools>=42.0.0", "wheel", "setuptools_scm"]
build-backend = "setuptools.build_meta"


[tool.setuptools_scm]
write_to = "src/napari_3d_ortho_viewer/_version.py"

[tool.black]
line-length = 79
target-version = ['py38', 'py39', 'py310']


[tool.ruff]
line-length = 79
select = [
"E", "F", "W", #flake8
"UP", # pyupgrade
"I", # isort
"BLE", # flake8-blind-exception
"B", # flake8-bugbear
"A", # flake8-builtins
"C4", # flake8-comprehensions
"ISC", # flake8-implicit-str-concat
"G", # flake8-logging-format
"PIE", # flake8-pie
"SIM", # flake8-simplify
]
ignore = [
"E501", # line too long. let black handle this
"UP006", "UP007", # type annotation. As using magicgui require runtime type annotation then we disable this.
"SIM117", # flake8-simplify - some of merged with statements are not looking great with black, reanble after drop python 3.9
]

exclude = [
".bzr",
".direnv",
".eggs",
".git",
".mypy_cache",
".pants.d",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"*vendored*",
"*_vendor*",
]

target-version = "py38"
fix = true
53 changes: 36 additions & 17 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
[metadata]
name = napari-3d-ortho-viewer

author = Niklas Netter
author_email = niknett@gmail.com
url = https://github.com/gatoniel/napari-3d-ortho-viewer
license = MIT
description = Napari 3D Ortho Viewer - an ortho viewer for napari for 3D images
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/gatoniel/napari-3d-ortho-viewer
author = Niklas Netter
author_email = niknett@gmail.com
license = MIT
license_files = LICENSE
classifiers =
Development Status :: 2 - Pre-Alpha
Intended Audience :: Developers
Framework :: napari
Topic :: Software Development :: Testing
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Operating System :: OS Independent
License :: OSI Approved :: MIT License
Programming Language :: Python :: 3.10
Topic :: Scientific/Engineering :: Image Processing
project_urls =
Bug Tracker = https://github.com/gatoniel/napari-3d-ortho-viewer/issues
Documentation = https://github.com/gatoniel/napari-3d-ortho-viewer#README.md
Expand All @@ -28,18 +30,35 @@ project_urls =

[options]
packages = find:
python_requires = >=3.7
install_requires =
numpy
magicgui
qtpy
scikit-image

python_requires = >=3.8
include_package_data = True
package_dir =
=src

setup_requires = setuptools_scm
# add your package requirements here
install_requires =
napari-plugin-engine>=0.1.4
numpy

[options.packages.find]
where = src

[options.entry_points]
napari.plugin =
napari-3d-ortho-viewer = napari_3d_ortho_viewer
[options.entry_points]
napari.manifest =
napari-3d-ortho-viewer = napari_3d_ortho_viewer:napari.yaml

[options.extras_require]
testing =
tox
pytest # https://docs.pytest.org/en/latest/contents.html
pytest-cov # https://pytest-cov.readthedocs.io/en/latest/
pytest-qt # https://pytest-qt.readthedocs.io/en/latest/
napari
pyqt5


[options.package_data]
* = *.yaml
17 changes: 13 additions & 4 deletions src/napari_3d_ortho_viewer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
__version__ = "0.0.1"
try:
from ._version import version as __version__
except ImportError:
__version__ = "unknown"


from ._dock_widget import napari_experimental_provide_dock_widget
from ._crop_dock_list_widget import napari_register_crop_list_dock_widget
from ._crop_dock_widget import napari_register_crop_dock_widget
from ._dock_widget import OrthoViewerWidget
from ._crop_dock_list_widget import CropListLabelsWidget
from ._crop_dock_widget import CropLabelsWidget

__all__ = (
"OrthoViewerWidget",
"CropListLabelsWidget",
"CropLabelsWidget",
)
Loading

0 comments on commit 3bdd307

Please sign in to comment.