Repository: BioimageAnalysisCoreWEHI/napari_lattice (language: python)

Issue:
setting up actions
Hi @haesleinhuepf 
      I'm testing out napari_lattice and learning how to publish it as a pypi package. 
I'm having trouble setting up github actions and automated testing/deployment. 
Would you mind helping me out with this?

Cheers

Pradeep


Discussion / hints:
Hi @pr4deepr ,

sure! I'm happy to help with getting the tests running. I'll send a PR.

Deployment I typically don't do via github actions. I deploy manually using these four commands:
```
python -m pip install --user --upgrade setuptools wheel

python setup.py sdist bdist_wheel

python -m pip install --user --upgrade twine

python -m twine upload --repository pypi dist/*
```
Give it a try! [Read more about the detailed procedure](https://github.com/PolarizedLightFieldMicroscopy/napari-LF#deployment-to-pypi).

You need a [pypi-account](https://pypi.org/account/register/) for this; just in case you have none yet.
THanks @haesleinhuepf 
BTW, I had two tests which I had removed. 
I've added them back and maybe you can let me know if they work well or not:
https://github.com/BioimageAnalysisCoreWEHI/napari_lattice/tree/master/src/napari_lattice/_tests
I had trouble with github actions and running the tests. 

In regard to publishing on pypi, I did try the commands you mentioned, and there is a package here
https://pypi.org/project/napari-lattice/

However, I cannot see it in napari-hub.. not sure what I'm doing wrong...


Fix patch:
diff --git a/tox.ini b/tox.ini
index 0609e344..2f2e26fc 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,9 +5,9 @@ isolated_build=true
 
 [gh-actions]
 python =
-    3.7: py37
     3.8: py38
     3.9: py39
+    3.10: py310
 
 [gh-actions:env]
 PLATFORM =


Test patch:
diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml
index 4dc28da2..741e9e9d 100644
--- a/.github/workflows/test_and_deploy.yml
+++ b/.github/workflows/test_and_deploy.yml
@@ -13,7 +13,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7', '3.8', '3.9']
+        python-version: ['3.8', '3.9', '3.10']
 
     steps:
       - uses: actions/checkout@v2
@@ -32,11 +32,11 @@ jobs:
           python --version
           conda install -y pyopencl pocl
           python -m pip install --upgrade pip
-          pip install setuptools wheel pytest pytest-cov
+          python -m pip install setuptools tox tox-gh-actions wheel pytest pytest-cov pytest-qt pyqt5
           pip install -e .
       - name: Test
         shell: bash -l {0}
-        run: pytest -v --cov=./ --cov-report=xml
+        run: pytest -v --color=yes --cov=napari_lattice --cov-report=xml
       - name: Coverage
         uses: codecov/codecov-action@v1
 
diff --git a/src/napari_lattice/_tests/test_crop_deskew.py b/src/napari_lattice/_tests/test_crop_deskew.py
index e84ae5bc..fcdfd43b 100644
--- a/src/napari_lattice/_tests/test_crop_deskew.py
+++ b/src/napari_lattice/_tests/test_crop_deskew.py
@@ -13,7 +13,7 @@ def test_crop_deskew():
 
 
     #Crop area of interest
-    ref_crop_deskew_img = deskewed[1:2,3:5,3:5]
+    ref_crop_deskew_img = deskewed[1:3,3:5,3:5]
 
     #roi generated from crop array (x,y)
     roi = np.array(((3,3),(3,5),(5,5),(5,3)))
diff --git a/src/napari_lattice/_tests/test_deskew.py b/src/napari_lattice/_tests/test_deskew.py
index 1bbc670d..9d3a451b 100644
--- a/src/napari_lattice/_tests/test_deskew.py
+++ b/src/napari_lattice/_tests/test_deskew.py
@@ -10,7 +10,7 @@ def test_deskew():
  
     deskewed = cle.deskew_y(raw,angle_in_degrees=60)
 
-    assert deskewed.shape == (4,7,5)
+    assert deskewed.shape == (4,8,5)
     assert deskewed[3,2,0] == 1
 
     
diff --git a/src/napari_lattice/_tests/test_dock_widget.py b/src/napari_lattice/_tests/test_dock_widget.py
index 4617363c..889979f4 100644
--- a/src/napari_lattice/_tests/test_dock_widget.py
+++ b/src/napari_lattice/_tests/test_dock_widget.py
@@ -1,9 +1,11 @@
 from napari_lattice._dock_widget import _napari_lattice_widget_wrapper
 import numpy as np
+import pytest
 
 #Test if the widget can be created
 
 # make_napari_viewer is a pytest fixture that returns a napari viewer object
+@pytest.mark.skip(reason="GUI tests currently fail in github CI, unclear why")
 def test_dock_widget(make_napari_viewer):
     # make viewer and add an image layer using our fixture
     viewer = make_napari_viewer()