From 90a097a532ad0687199d09086068b254c2e5ae15 Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 16:39:00 +0200 Subject: [PATCH 01/20] Create docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/docmd-wiki.yml diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml new file mode 100644 index 0000000..7da2eff --- /dev/null +++ b/.github/workflows/docmd-wiki.yml @@ -0,0 +1,50 @@ +name: Generate and Push Docs to Wiki + +on: + workflow_dispatch: + +jobs: + generate-docs: + runs-on: ubuntu-latest + + steps: + - name: Checkout this repo (optional) + uses: actions/checkout@v4 + + - name: Install Python and docmd + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install docmd + run: pip install docmd + + - name: Clone PyPlaque repository + run: | + git clone https://github.com/plaque2/PyPlaque.git + cd PyPlaque + pip install -e . + mkdir -p docs + docmd PyPlaque.experiment -out docs + docmd PyPlaque.phenotypes -out docs + docmd PyPlaque.specimen -out docs + docmd PyPlaque.utils -out docs + docmd PyPlaque.view -out docs + cd ../ + + - name: Clone PyPlaque.wiki repository + run: | + git clone https://github.com/plaque2/PyPlaque.wiki.git wiki + + - name: Copy generated docs to wiki + run: | + cp -v PyPlaque/docs/*.md PyPlaque.wiki/ + + - name: Commit and push to Wiki + run: | + cd PyPlaque.wiki + git config user.name "github-actions" + git config user.email "github-actions@github.com" + git add . + git commit -m "Update docs from PyPlaque using docmd" || echo "No changes to commit" + git push From 21619d61cc7faba53fcb5798b235f6ba57fbcb93 Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 16:42:58 +0200 Subject: [PATCH 02/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index 7da2eff..3c01a35 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -21,7 +21,6 @@ jobs: - name: Clone PyPlaque repository run: | - git clone https://github.com/plaque2/PyPlaque.git cd PyPlaque pip install -e . mkdir -p docs From 3b1d3233019fa2f44be0eda5ae160e38bf9b9cf5 Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 16:50:30 +0200 Subject: [PATCH 03/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index 3c01a35..a35a250 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -21,7 +21,7 @@ jobs: - name: Clone PyPlaque repository run: | - cd PyPlaque + ls pip install -e . mkdir -p docs docmd PyPlaque.experiment -out docs From 7d806ee55ca4d321d1f27b9ffb869e7eb5e7240a Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 16:53:28 +0200 Subject: [PATCH 04/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index a35a250..44090c3 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -14,7 +14,7 @@ jobs: - name: Install Python and docmd uses: actions/setup-python@v5 with: - python-version: '3.x' + python-version: '3.12' - name: Install docmd run: pip install docmd From 594f687801e4a0334ca4320cf4d2bdf40037d05d Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 16:58:22 +0200 Subject: [PATCH 05/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index 44090c3..bb5ed42 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -14,12 +14,12 @@ jobs: - name: Install Python and docmd uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.11' - name: Install docmd run: pip install docmd - - name: Clone PyPlaque repository + - name: Create MD files from PyPlaque docstrings run: | ls pip install -e . From 43cd9228abb94b9e3be191f730b13de3a4bb624b Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 17:02:01 +0200 Subject: [PATCH 06/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index bb5ed42..c63c10f 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -24,12 +24,12 @@ jobs: ls pip install -e . mkdir -p docs - docmd PyPlaque.experiment -out docs - docmd PyPlaque.phenotypes -out docs - docmd PyPlaque.specimen -out docs - docmd PyPlaque.utils -out docs - docmd PyPlaque.view -out docs - cd ../ + docmd PyPlaque.experiment --out docs + docmd PyPlaque.phenotypes --out docs + docmd PyPlaque.specimen --out docs + docmd PyPlaque.utils --out docs + docmd PyPlaque.view --out docs + cd docs - name: Clone PyPlaque.wiki repository run: | @@ -37,7 +37,7 @@ jobs: - name: Copy generated docs to wiki run: | - cp -v PyPlaque/docs/*.md PyPlaque.wiki/ + cp -v *.md PyPlaque.wiki/ - name: Commit and push to Wiki run: | From 46e702008d527f5224c8b0bd0099ba86b7f956df Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 17:57:38 +0200 Subject: [PATCH 07/20] Update picks.py wrap strel into a function --- PyPlaque/utils/picks.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/PyPlaque/utils/picks.py b/PyPlaque/utils/picks.py index 1f18c4c..ead1169 100644 --- a/PyPlaque/utils/picks.py +++ b/PyPlaque/utils/picks.py @@ -1,10 +1,21 @@ import numpy as np from scipy import ndimage as ndi -STREL_4 = np.array([[0, 1, 0], +def get_strel(neighbourhood): +""" +**Get structural elements Function** + This function returns structural elements of the defined neighbourhood. +Args: + neighbourhood (int, required): Neighbourhood value of 4 or 8. +Returns: + np.uint8 array of the structural element. +""" + if neighbourhood == 4: + return np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]], dtype=np.uint8) -STREL_8 = np.ones((3, 3), dtype=np.uint8) + elif neighbourhood == 8: + return np.ones((3, 3), dtype=np.uint8) def picks_area(image, neighbourhood=4): """ @@ -31,10 +42,7 @@ def picks_area(image, neighbourhood=4): TypeError: If `image` is not a 2D numpy array or `neighbourhood` is not an integer. ValueError: If `neighbourhood` is not either 4 or 8. """ - if neighbourhood == 4: - strel = STREL_4 - elif neighbourhood == 8: - strel = STREL_8 + strel = get_strel(neighbourhood) image = image.astype(np.uint8) eroded_image = ndi.binary_erosion(image, strel, border_value=0) border_image = image - eroded_image @@ -86,10 +94,7 @@ def picks_perimeter(image, neighbourhood=4): TypeError: If `image` is not a 2D numpy array or `neighbourhood` is not an integer. ValueError: If `neighbourhood` is not either 4 or 8. """ - if neighbourhood == 4: - strel = STREL_4 - else: - strel = STREL_8 + strel = get_strel(neighbourhood) image = image.astype(np.uint8) (w, h) = image.shape From 219387dc4851b2af88dad9dfdafb47e786807828 Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 18:00:41 +0200 Subject: [PATCH 08/20] Update picks.py --- PyPlaque/utils/picks.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/PyPlaque/utils/picks.py b/PyPlaque/utils/picks.py index ead1169..6bb246b 100644 --- a/PyPlaque/utils/picks.py +++ b/PyPlaque/utils/picks.py @@ -2,14 +2,16 @@ from scipy import ndimage as ndi def get_strel(neighbourhood): -""" -**Get structural elements Function** - This function returns structural elements of the defined neighbourhood. -Args: - neighbourhood (int, required): Neighbourhood value of 4 or 8. -Returns: - np.uint8 array of the structural element. -""" + """ + **Get structural elements Function** + This function returns structural elements of the defined neighbourhood. + + Args: + neighbourhood (int, required): Neighbourhood value of 4 or 8. + + Returns: + np.uint8 array of the structural element. + """ if neighbourhood == 4: return np.array([[0, 1, 0], [1, 1, 1], From 756268f9c7080a56fdb40456fa7f72b54f3ae9e4 Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 18:04:07 +0200 Subject: [PATCH 09/20] Update picks.py --- PyPlaque/utils/picks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PyPlaque/utils/picks.py b/PyPlaque/utils/picks.py index 6bb246b..0859770 100644 --- a/PyPlaque/utils/picks.py +++ b/PyPlaque/utils/picks.py @@ -3,7 +3,7 @@ def get_strel(neighbourhood): """ - **Get structural elements Function** + **get_strel Function** This function returns structural elements of the defined neighbourhood. Args: From 3936086ef1bcc7258fc1197cf1a5e6ad999a782a Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 18:05:36 +0200 Subject: [PATCH 10/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index c63c10f..daa2857 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -47,3 +47,5 @@ jobs: git add . git commit -m "Update docs from PyPlaque using docmd" || echo "No changes to commit" git push + cd ../../ + rm -rf docs From 4f3780825fd0e0763d64bce6beb12d24e89caeb0 Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 18:10:37 +0200 Subject: [PATCH 11/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index daa2857..b3faa97 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -37,11 +37,11 @@ jobs: - name: Copy generated docs to wiki run: | - cp -v *.md PyPlaque.wiki/ + cp -v *.md wiki/ - name: Commit and push to Wiki run: | - cd PyPlaque.wiki + cd wiki git config user.name "github-actions" git config user.email "github-actions@github.com" git add . From b9aa04235ba1fed085ff5a781f25fd824c87abef Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 18:45:17 +0200 Subject: [PATCH 12/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index b3faa97..3e10d62 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -8,8 +8,11 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout this repo (optional) + - name: Checkout wiki repo uses: actions/checkout@v4 + with: + repository: ${{ github.repository }}.wiki + path: wiki - name: Install Python and docmd uses: actions/setup-python@v5 @@ -31,21 +34,11 @@ jobs: docmd PyPlaque.view --out docs cd docs - - name: Clone PyPlaque.wiki repository - run: | - git clone https://github.com/plaque2/PyPlaque.wiki.git wiki - - name: Copy generated docs to wiki run: | cp -v *.md wiki/ - name: Commit and push to Wiki run: | - cd wiki - git config user.name "github-actions" - git config user.email "github-actions@github.com" - git add . - git commit -m "Update docs from PyPlaque using docmd" || echo "No changes to commit" - git push cd ../../ rm -rf docs From fb0feb8ad7e93132233096a265d9372ebda966bc Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 18:52:01 +0200 Subject: [PATCH 13/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index 3e10d62..3f5e501 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -13,8 +13,14 @@ jobs: with: repository: ${{ github.repository }}.wiki path: wiki + + - name: Checkout PyPlaque repo + uses: actions/checkout@v4 + with: + repository: ${{ github.repository }} + path: PyPlaque - - name: Install Python and docmd + - name: Install Python uses: actions/setup-python@v5 with: python-version: '3.11' @@ -25,6 +31,7 @@ jobs: - name: Create MD files from PyPlaque docstrings run: | ls + cd PyPlaque pip install -e . mkdir -p docs docmd PyPlaque.experiment --out docs @@ -32,13 +39,15 @@ jobs: docmd PyPlaque.specimen --out docs docmd PyPlaque.utils --out docs docmd PyPlaque.view --out docs - cd docs - name: Copy generated docs to wiki run: | - cp -v *.md wiki/ + cp -v docs/*.md ../wiki/ + rm -rf docs - - name: Commit and push to Wiki +- name: Run script to update wiki run: | - cd ../../ - rm -rf docs + cd ../wiki + git add . + git commit -m "Updated wiki with a new page" + git push From 682ef1575198558db364ed98ff2b23b12351ba96 Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 18:53:59 +0200 Subject: [PATCH 14/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index 3f5e501..181eb25 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -45,7 +45,7 @@ jobs: cp -v docs/*.md ../wiki/ rm -rf docs -- name: Run script to update wiki + - name: Run script to update wiki run: | cd ../wiki git add . From fd7cde71db348af5faff97da8f977cc853018e4c Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Fri, 4 Jul 2025 18:58:34 +0200 Subject: [PATCH 15/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index 181eb25..3dd7ed2 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -42,7 +42,9 @@ jobs: - name: Copy generated docs to wiki run: | - cp -v docs/*.md ../wiki/ + cd docs + cp -v *.md ../../wiki/ + cd ../ rm -rf docs - name: Run script to update wiki From 84a427df6153ead15fab90d39f1c1ed03805fda7 Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Mon, 7 Jul 2025 10:18:02 +0200 Subject: [PATCH 16/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index 3dd7ed2..903ce8d 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -27,25 +27,21 @@ jobs: - name: Install docmd run: pip install docmd - - - name: Create MD files from PyPlaque docstrings + + - name: Check existing paths run: | + pwd ls + + - name: Create MD files from PyPlaque docstrings + run: | cd PyPlaque pip install -e . - mkdir -p docs - docmd PyPlaque.experiment --out docs - docmd PyPlaque.phenotypes --out docs - docmd PyPlaque.specimen --out docs - docmd PyPlaque.utils --out docs - docmd PyPlaque.view --out docs - - - name: Copy generated docs to wiki - run: | - cd docs - cp -v *.md ../../wiki/ - cd ../ - rm -rf docs + docmd PyPlaque.experiment --out ../wiki + docmd PyPlaque.phenotypes --out ../wiki + docmd PyPlaque.specimen --out ../wiki + docmd PyPlaque.utils --out ../wiki + docmd PyPlaque.view --out ../wiki - name: Run script to update wiki run: | From 19a8bcb40b76dfa6717886feaea03b407be57297 Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Mon, 7 Jul 2025 10:25:56 +0200 Subject: [PATCH 17/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index 903ce8d..0645844 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -36,6 +36,7 @@ jobs: - name: Create MD files from PyPlaque docstrings run: | cd PyPlaque + pwd pip install -e . docmd PyPlaque.experiment --out ../wiki docmd PyPlaque.phenotypes --out ../wiki @@ -43,6 +44,11 @@ jobs: docmd PyPlaque.utils --out ../wiki docmd PyPlaque.view --out ../wiki + - name: Check existing paths + run: | + pwd + ls + - name: Run script to update wiki run: | cd ../wiki From d9f54ba68388fff9d8b3f29a9e21d38e31755567 Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Mon, 7 Jul 2025 10:34:35 +0200 Subject: [PATCH 18/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index 0645844..fde8f70 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -51,7 +51,7 @@ jobs: - name: Run script to update wiki run: | - cd ../wiki + cd wiki git add . git commit -m "Updated wiki with a new page" git push From d5545c2664dc1aff1f1e60144afce9a76efb2d22 Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Mon, 7 Jul 2025 10:41:05 +0200 Subject: [PATCH 19/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index fde8f70..0121cac 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -52,6 +52,8 @@ jobs: - name: Run script to update wiki run: | cd wiki + git config --global user.email "noreply@github.com" + git config --global user.name "gh_actions_runner" git add . git commit -m "Updated wiki with a new page" git push From 55517e7c06774b014e16827939328efac8aa83e8 Mon Sep 17 00:00:00 2001 From: "Artur Yakimovich, PhD" Date: Mon, 7 Jul 2025 10:55:30 +0200 Subject: [PATCH 20/20] Update docmd-wiki.yml --- .github/workflows/docmd-wiki.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docmd-wiki.yml b/.github/workflows/docmd-wiki.yml index 0121cac..fe91381 100644 --- a/.github/workflows/docmd-wiki.yml +++ b/.github/workflows/docmd-wiki.yml @@ -1,7 +1,8 @@ name: Generate and Push Docs to Wiki on: - workflow_dispatch: + release: + types: [created] jobs: generate-docs: