Repository: pyxem/kikuchipy (language: python)

Issue:
Allow publish action to fail uploading to TestPyPI
#### Description of the change
<!-- Remember to branch off the develop branch for new features and the main branch for patches. -->
Wanted to check whether docs were not included in the PyPI upload, so I uploaded the source distribution tagged with 0.8.0 from my machine to TestPyPI. The docs were not included, great. But now the automatic upload from GitHub fails because 0.8.0 already exists on TestPyPI. Not great.

This is (temporarily?) fixed by allowing the publish action to fail uploading to TestPyPI.

#### Progress of the PR
- [n/a] [Docstrings for all functions](https://github.com/numpy/numpy/blob/master/doc/example.py)
- [n/a] Unit tests with pytest for all lines
- [n/a] Clean code style by [running black via pre-commit](https://kikuchipy.org/en/latest/contributing.html#code-style)

#### For reviewers
<!-- Don't remove the checklist below. -->
- [ ] The PR title is short, concise, and will make sense 1 year later.
- [ ] New functions are imported in corresponding `__init__.py`.
- [ ] New features, API changes, and deprecations are mentioned in the unreleased
      section in `CHANGELOG.rst`.
- [ ] New contributors are added to `release.py`, `.zenodo.json` and
      `.all-contributorsrc` with the table regenerated.



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/perhaps_make_tagged_release_draft.yml b/.github/workflows/perhaps_make_tagged_release_draft.yml
index 33d2fa12..193ffa23 100644
--- a/.github/workflows/perhaps_make_tagged_release_draft.yml
+++ b/.github/workflows/perhaps_make_tagged_release_draft.yml
@@ -14,16 +14,20 @@ jobs:
   make-tagged-release:
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v2
+    - uses: actions/checkout@v3
+
     - uses: r-lib/actions/setup-pandoc@v1
+
     - name: Set up Python ${{ runner.python-version }}
-      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 outdated
+
     - name: Check whether a tagged release draft should be made
       run: |
         cd .github/workflows
@@ -31,9 +35,12 @@ jobs:
         echo "MAKE_RELEASE=${x[0]}" >> $GITHUB_ENV
         echo "PYPI_VERSION=${x[1]}" >> $GITHUB_ENV
         echo "BRANCH_VERSION=${x[2]}" >> $GITHUB_ENV
+
     - name: Make tagged release draft body from changelog
       if: ${{ env.MAKE_RELEASE == 'true' }}
-      run: pandoc .github/workflows/release_part_in_changelog.rst -f rst -t markdown -o release_part_in_changelog.md --wrap=none
+      run: |
+        pandoc .github/workflows/release_part_in_changelog.rst -f rst -t markdown -o release_part_in_changelog.md --wrap=none
+
     - name: Make tagged release draft
       if: ${{ env.MAKE_RELEASE == 'true' }}
       uses: actions/create-release@v1
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 4b494ead..cab9961b 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -21,10 +21,10 @@ jobs:
   upload:
     runs-on: ubuntu-latest
     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'
 
@@ -39,6 +39,7 @@ jobs:
 
     - name: Publish package to TestPyPI
       uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
+      continue-on-error: true
       with:
         user: __token__
         password: ${{ secrets.TEST_PYPI_API_TOKEN }}
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 0bbac755..34239242 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -16,6 +16,24 @@ were listed in alphabetical order by first name until version 0.7.0.
 Unreleased
 ==========
 
+Added
+-----
+
+Changed
+-------
+
+Deprecated
+----------
+
+Removed
+-------
+
+Fixed
+-----
+
+0.8.0 (2023-02-11)
+==================
+
 Added
 -----
 - ``kikuchipy.imaging.VirtualBSEImager`` replaces the
@@ -109,7 +127,7 @@ Added
 
 Changed
 -------
-- Minimal version of orix set to >= 0.11 and of numba set to >= 0.55.
+- Minimal version of orix set to >= 0.11 and of Numba set to >= 0.55.
   (`#608 <https://github.com/pyxem/kikuchipy/pull/608>`_)
 - Added warnings when trying to perform adaptive histogram equalization on a signal with
   data in floating type or when some of the data is NaN.
@@ -128,8 +146,6 @@ Changed
   (`#588 <https://github.com/pyxem/kikuchipy/pull/588>`_)
 - Minimal version of HyperSpy increased to >= 1.7.3.
   (`#585 <https://github.com/pyxem/kikuchipy/pull/585>`_)
-- Minimal version of Numba increased to >= 0.52.
-  (`#585 <https://github.com/pyxem/kikuchipy/pull/585>`_)
 - When binning the navigation dimension(s) with ``EBSD.rebin()``, the class attributes
   ``xmap`` and ``static_background`` are set to ``None`` and ``detector.pc`` is set to
   ``[0.5, 0.5, 0.5]`` in the appropriate navigation shape. If the signal dimension(s)
@@ -198,9 +214,6 @@ Fixed
   (e.g. ``Scan 1/EBSD/Header/n_columns`` and ``n_rows``).
   (`#578 <https://github.com/pyxem/kikuchipy/pull/578>`_)
 
-Security
---------
-
 0.7.0 (2022-10-29)
 ==================
 
diff --git a/doc/tutorials/hybrid_indexing.ipynb b/doc/tutorials/hybrid_indexing.ipynb
index 8fd22791..75528599 100644
--- a/doc/tutorials/hybrid_indexing.ipynb
+++ b/doc/tutorials/hybrid_indexing.ipynb
@@ -515,7 +515,11 @@
   {
    "cell_type": "code",
    "execution_count": 16,
-   "metadata": {},
+   "metadata": {
+    "tags": [
+     "nbval-ignore-output"
+    ]
+   },
    "outputs": [
     {
      "name": "stdout",
@@ -1126,7 +1130,11 @@
   {
    "cell_type": "code",
    "execution_count": 38,
-   "metadata": {},
+   "metadata": {
+    "tags": [
+     "nbval-ignore-output"
+    ]
+   },
    "outputs": [
     {
      "name": "stdout",
@@ -1374,7 +1382,8 @@
      "tooltip": "Hough indexing, re-indexing of bad points with dictionary indexing, refinement of all points, and finally recombination into a single map"
     },
     "tags": [
-     "nbsphinx-thumbnail"
+     "nbsphinx-thumbnail",
+     "nbval-ignore-output"
     ]
    },
    "outputs": [
@@ -1677,7 +1686,11 @@
   {
    "cell_type": "code",
    "execution_count": 51,
-   "metadata": {},
+   "metadata": {
+    "tags": [
+     "nbval-ignore-output"
+    ]
+   },
    "outputs": [
     {
      "name": "stdout",
@@ -1733,7 +1746,11 @@
   {
    "cell_type": "code",
    "execution_count": 53,
-   "metadata": {},
+   "metadata": {
+    "tags": [
+     "nbval-ignore-output"
+    ]
+   },
    "outputs": [
     {
      "data": {
@@ -1841,7 +1858,11 @@
   {
    "cell_type": "code",
    "execution_count": 57,
-   "metadata": {},
+   "metadata": {
+    "tags": [
+     "nbval-ignore-output"
+    ]
+   },
    "outputs": [
     {
      "name": "stdout",
@@ -1892,7 +1913,11 @@
   {
    "cell_type": "code",
    "execution_count": 59,
-   "metadata": {},
+   "metadata": {
+    "tags": [
+     "nbval-ignore-output"
+    ]
+   },
    "outputs": [
     {
      "name": "stdout",
diff --git a/doc/tutorials/mandm2021_sunday_short_course.ipynb b/doc/tutorials/mandm2021_sunday_short_course.ipynb
index 29c56aed..b1dd59c7 100644
--- a/doc/tutorials/mandm2021_sunday_short_course.ipynb
+++ b/doc/tutorials/mandm2021_sunday_short_course.ipynb
@@ -301,7 +301,7 @@
    "id": "6a1b028b",
    "metadata": {},
    "source": [
-    "Plot the grid with `plot_grid()`"
+    "Plot the grid with `plot_grid()` (not keeping the output signal)"
    ]
   },
   {
@@ -322,7 +322,7 @@
     }
    ],
    "source": [
-    "vbse_imager.plot_grid();"
+    "_ = vbse_imager.plot_grid();"
    ]
   },
   {
@@ -447,7 +447,7 @@
    ],
    "source": [
     "fig = plt.figure(figsize=(14, 10))\n",
-    "hs.plot.plot_images(vbse_imgs, fig=fig, axes_decor=None);"
+    "_ = hs.plot.plot_images(vbse_imgs, fig=fig, axes_decor=None);"
    ]
   },
   {
@@ -617,7 +617,7 @@
     "bg = s.static_background\n",
     "\n",
     "fig, ax = plt.subplots()\n",
-    "ax.imshow(bg, cmap=\"gray\");"
+    "_ = ax.imshow(bg, cmap=\"gray\");"
    ]
   },
   {
diff --git a/doc/tutorials/pattern_matching.ipynb b/doc/tutorials/pattern_matching.ipynb
index 6323c2f0..18173a2f 100644
--- a/doc/tutorials/pattern_matching.ipynb
+++ b/doc/tutorials/pattern_matching.ipynb
@@ -483,7 +483,7 @@
     "ax[0].imshow(p * signal_mask, cmap=\"gray\")\n",
     "ax[0].set_title(\"Not used in matching\")\n",
     "ax[1].imshow(p * ~signal_mask, cmap=\"gray\")\n",
-    "ax[1].set_title(\"Used in matching\");"
+    "_ = ax[1].set_title(\"Used in matching\");"
    ]
   },
   {
diff --git a/doc/tutorials/pc_extrapolate_plane.ipynb b/doc/tutorials/pc_extrapolate_plane.ipynb
index 894b6191..4790cce8 100644
--- a/doc/tutorials/pc_extrapolate_plane.ipynb
+++ b/doc/tutorials/pc_extrapolate_plane.ipynb
@@ -446,7 +446,11 @@
   {
    "cell_type": "code",
    "execution_count": 16,
-   "metadata": {},
+   "metadata": {
+    "tags": [
+     "nbval-ignore-output"
+    ]
+   },
    "outputs": [
     {
      "name": "stdout",
diff --git a/doc/tutorials/pc_fit_plane.ipynb b/doc/tutorials/pc_fit_plane.ipynb
index 7b1d278f..ae7aae73 100644
--- a/doc/tutorials/pc_fit_plane.ipynb
+++ b/doc/tutorials/pc_fit_plane.ipynb
@@ -63,7 +63,11 @@
   {
    "cell_type": "code",
    "execution_count": 2,
-   "metadata": {},
+   "metadata": {
+    "tags": [
+     "nbval-ignore-output"
+    ]
+   },
    "outputs": [
     {
      "name": "stderr",
@@ -289,7 +293,7 @@
     "# Annotate\n",
     "ax = fig.axes[0]\n",
     "ax.text(25, 1, \"Bottom\", va=\"top\", ha=\"center\")\n",
-    "ax.text(25, 49, \"Top\", va=\"bottom\", ha=\"center\");"
+    "_ = ax.text(25, 49, \"Top\", va=\"bottom\", ha=\"center\");"
    ]
   },
   {
@@ -786,7 +790,11 @@
   {
    "cell_type": "code",
    "execution_count": 20,
-   "metadata": {},
+   "metadata": {
+    "tags": [
+     "nbval-ignore-output"
+    ]
+   },
    "outputs": [
     {
      "name": "stdout",
diff --git a/doc/tutorials/run_nbval.sh b/doc/tutorials/run_nbval.sh
index 01652440..f394eed6 100755
--- a/doc/tutorials/run_nbval.sh
+++ b/doc/tutorials/run_nbval.sh
@@ -4,29 +4,20 @@
 #   $ chmod u+x ./doc/tutorials/run_nbval.sh
 #   $ ./doc/tutorials/run_nbval.sh
 
-# List notebooks that nbval should skip
-declare -a SKIP=(\
-  "esteem2022_diffraction_workshop.ipynb"\
-  "pc_orientation_dependence.ipynb"\
+# List notebooks that nbval should run
+declare -a NOTEBOOKS=(\
+  "hough_indexing.ipynb"\
+  "hybrid_indexing.ipynb"\
+  "mandm2021_sunday_short_course.ipynb"\
+  "pattern_matching.ipynb"\
+  "pc_extrapolate_plane.ipynb"\
+  "pc_fit_plane.ipynb"\
 )
 
-# Find all notebooks in the doc/tutorials directory
-readarray -t ALL_NOTEBOOKS < <(find doc/tutorials -maxdepth 1 -type f -name "*.ipynb")
-declare -a ALL_NOTEBOOKS
-
-# Remove notebooks to skip
-for i in "${!ALL_NOTEBOOKS[@]}"; do
-  NOTEBOOK="${ALL_NOTEBOOKS[i]}"
-  SKIP_THIS=0
-  for j in "${!SKIP[@]}"; do
-    if [[ "${NOTEBOOK}" = doc/tutorials/"${SKIP[j]}" ]]; then
-      SKIP_THIS=1
-    fi
-  done
-  if [[ "${SKIP_THIS}" = 0 ]]; then
-    NOTEBOOKS[$i]="${NOTEBOOK}"
-  fi
+# Append relative path to notebook names
+for i in "${!NOTEBOOKS[@]}"; do
+  NOTEBOOKS[i]=doc/tutorials/"${NOTEBOOKS[i]}"
 done
 
 # Test with nbval
-pytest -v --nbval "${NOTEBOOKS[@]}" --sanitize-with doc/tutorials/tutorials_sanitize.cfg
+pytest -v --nbval "${NOTEBOOKS[@]}" --nbval-sanitize-with doc/tutorials/tutorials_sanitize.cfg
diff --git a/doc/tutorials/tutorials_sanitize.cfg b/doc/tutorials/tutorials_sanitize.cfg
index 4fce1939..b30cb66f 100644
--- a/doc/tutorials/tutorials_sanitize.cfg
+++ b/doc/tutorials/tutorials_sanitize.cfg
@@ -6,14 +6,14 @@ replace: TIME
 # Example: [#] | 100% Completed | 303.49 ms -> [#] | 100% Completed | TIME
 
 [regex2]
-regex: \d+ (?=patterns/s)
-replace: N_PATTERNS
-# Example: 1 patterns/s -> N_PATTERNS patterns/s
+regex: \d+.\d+ (?=patterns/s)
+replace: N
+# Example: 1.2 patterns/s -> N_PATTERNS patterns/s
 
 [regex3]
-regex: \d+ (?=comparisons/s)
-replace: N_COMPARISONS
-# Example: 1 comparisons/s -> N_COMPARISONS comparisons/s
+regex: \d+.\d+ (?=comparisons/s)
+replace: N
+# Example: 1.5 comparisons/s -> N comparisons/s
 
 [regex4]
 regex: ^100%(.*)it/s\]$
@@ -22,4 +22,14 @@ replace: TQDM_PROGRESSBAR
 [regex5]
 regex: (?<=Figure size )\d+x\d+.\d+
 replace: FIGURE_SIZE
-# Example: Figure size 640x408.116 -> Figure size FIGURE_SIZE
\ No newline at end of file
+# Example: Figure size 640x408.116 -> Figure size FIGURE_SIZE
+
+[regex6]
+regex: (?<=Refining )\d+
+replace: N
+# Example: Refining 12900 orientation(s) -> Refining N orientation(s)
+
+[regex7]
+regex: (?<=Matching )\d+/\d+
+replace: M/N
+# Example: Matching 12871/29800 -> Matching M/N
diff --git a/kikuchipy/release.py b/kikuchipy/release.py
index 02c0926c..39dd1869 100644
--- a/kikuchipy/release.py
+++ b/kikuchipy/release.py
@@ -36,4 +36,4 @@
 name = "kikuchipy"
 platforms = ["Linux", "MacOS X", "Windows"]
 status = "Development"
-version = "0.8.dev0"
+version = "0.9.dev0"


Test patch:
diff --git a/.github/workflows/test_documentation_notebooks.yml b/.github/workflows/test_documentation_notebooks.yml
index f4548aff..aad00474 100644
--- a/.github/workflows/test_documentation_notebooks.yml
+++ b/.github/workflows/test_documentation_notebooks.yml
@@ -13,12 +13,12 @@ jobs:
     env:
       MPLBACKEND: agg
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
 
-      - name: Set up Python 3.9
-        uses: actions/setup-python@v2
+      - name: Set up Python
+        uses: actions/setup-python@v4
         with:
-          python-version: '3.9'
+          python-version: '3.10'
 
       - name: Display versions
         run: |
@@ -28,8 +28,8 @@ jobs:
       - name: Install package and dependencies
         shell: bash
         run: |
-          pip install -U -e .'[doc,tests,viz]'
-          pip install nbval
+          pip install -U -e .'[doc,tests,all]'
+          pip install -U nbval pyopencl
 
       - name: Test documentation notebooks
         run: |
diff --git a/kikuchipy/indexing/tests/test_merge_crystal_maps.py b/kikuchipy/indexing/tests/test_merge_crystal_maps.py
index c784f34f..06fbd56f 100644
--- a/kikuchipy/indexing/tests/test_merge_crystal_maps.py
+++ b/kikuchipy/indexing/tests/test_merge_crystal_maps.py
@@ -90,7 +90,7 @@ def test_merge_crystal_maps_1d(
             if v1 is None:
                 assert v1 is v2
             else:
-                np.allclose(v1, v2)
+                assert np.allclose(v1, v2)
 
         assert np.allclose(merged_xmap.phase_id, desired_phase_ids)
         assert np.allclose(merged_xmap.prop[scores_prop], desired_scores)