From eed3c1b2387d78ccf7f0593aa699711b12fd35a5 Mon Sep 17 00:00:00 2001 From: James Ryan Date: Thu, 10 Feb 2022 15:00:26 +1100 Subject: [PATCH 01/13] initial docs commit --- .github/workflows/build-docs.yml | 49 ++++++++++++++++++++++++++++++++ docs/usage.rst | 5 ++++ 2 files changed, 54 insertions(+) create mode 100644 .github/workflows/build-docs.yml create mode 100644 docs/usage.rst diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 0000000..a04c6aa --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,49 @@ +name: Build docs + +on: + pull_request: + branches: + - main + push: + branches: + - docs + workflow_dispatch: + +jobs: + + build-and-upload-artifact: + name: build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install 'setuptools<50.0' + python -m pip install .[testing,docs] + + - name: Build docs + run: | + cd doc + make html + cd .. + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: docs + path: doc/_build/html + + - name: Cache + uses: actions/cache@v2 + with: + path: | + doc/schizonts + key: full-data diff --git a/docs/usage.rst b/docs/usage.rst new file mode 100644 index 0000000..2ee172f --- /dev/null +++ b/docs/usage.rst @@ -0,0 +1,5 @@ +Using affinder +============== + +.. include:: ../.napari/DESCRIPTION.md + :parser: myst_parser.sphinx_ From 429bd948d35510b669992e5336dbc6cee165a69c Mon Sep 17 00:00:00 2001 From: James Ryan Date: Thu, 10 Feb 2022 15:08:44 +1100 Subject: [PATCH 02/13] added files and changed directory name --- .github/workflows/build-docs.yml | 2 +- docs/conf.py | 7 ++++--- docs/index.rst | 7 +++++-- setup.cfg | 5 +++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index a04c6aa..6ca52dd 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -31,7 +31,7 @@ jobs: - name: Build docs run: | - cd doc + cd docs make html cd .. diff --git a/docs/conf.py b/docs/conf.py index 9a8289f..7ec6199 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -31,6 +31,7 @@ # ones. extensions = [ 'sphinx.ext.ifconfig', + 'myst_parser', ] # Add any paths that contain templates here, relative to this directory. @@ -38,8 +39,8 @@ # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ['.rst', '.md'] +# source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' @@ -110,7 +111,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'alabaster' +html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/docs/index.rst b/docs/index.rst index 0450bd6..d44b710 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,11 +6,14 @@ Welcome to affinder's documentation! =============================================================== -Contents: - .. toctree:: :maxdepth: 2 + usage + + +.. include:: ../README.md + :parser: myst_parser.sphinx_ Indices and tables diff --git a/setup.cfg b/setup.cfg index a32ae97..15181d7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -53,7 +53,8 @@ testing = pytest-qt scikit-image[data] napari[pyqt5] - zarr - +docs = + sphinx-rtd-theme + myst-parser [options.package_data] affinder = napari.yaml From ed35abaab22740001ce1835c41e769cff18b11c2 Mon Sep 17 00:00:00 2001 From: James Ryan Date: Thu, 10 Feb 2022 15:13:14 +1100 Subject: [PATCH 03/13] fixed incorrect directory name --- .github/workflows/build-docs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 6ca52dd..6d7e682 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -39,11 +39,11 @@ jobs: uses: actions/upload-artifact@v2 with: name: docs - path: doc/_build/html + path: docs/_build/html - name: Cache uses: actions/cache@v2 with: path: | - doc/schizonts + docs/schizonts key: full-data From eaa5e22eaa966c6ad7a410fc4fa4a3c868298781 Mon Sep 17 00:00:00 2001 From: James Ryan Date: Thu, 10 Feb 2022 15:40:18 +1100 Subject: [PATCH 04/13] tidied up build job, added deploy --- .github/workflows/build-docs.yml | 13 ---------- .github/workflows/deploy-docs.yml | 42 +++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/deploy-docs.yml diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 6d7e682..fe5cb8c 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -34,16 +34,3 @@ jobs: cd docs make html cd .. - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: docs - path: docs/_build/html - - - name: Cache - uses: actions/cache@v2 - with: - path: | - docs/schizonts - key: full-data diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 0000000..185ce72 --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,42 @@ +name: Deploy docs + +on: + push: + branches: + - main + tags: + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + + build-and-deploy: + name: deploy + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install 'setuptools<50.0' + python -m pip install .[testing,docs] + + - name: Build docs + run: | + cd docs + make html + cd .. + + - name: Deploy docs 🚀 + uses: JamesIves/github-pages-deploy-action@4.1.5 + with: + branch: gh-pages + folder: docs/_build/html From 6f6f7b3d55f757a698b8786f2d02f18fd443c46f Mon Sep 17 00:00:00 2001 From: James Ryan Date: Mon, 14 Feb 2022 14:53:13 +1100 Subject: [PATCH 05/13] changed theme to Furo --- docs/conf.py | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 7ec6199..2d32dd0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -111,7 +111,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'sphinx_rtd_theme' +html_theme = 'furo' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/setup.cfg b/setup.cfg index 15181d7..4f88f12 100644 --- a/setup.cfg +++ b/setup.cfg @@ -54,7 +54,7 @@ testing = scikit-image[data] napari[pyqt5] docs = - sphinx-rtd-theme + furo myst-parser [options.package_data] affinder = napari.yaml From fd0a80c7c1c1f24c1729ae718c224f547c18c1fa Mon Sep 17 00:00:00 2001 From: James Ryan Date: Mon, 14 Feb 2022 14:56:21 +1100 Subject: [PATCH 06/13] added artifact upload for build step --- .github/workflows/build-docs.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index fe5cb8c..e8729fd 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -34,3 +34,9 @@ jobs: cd docs make html cd .. + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: docs + path: doc/_build/html From a470ec7abd2a751f98b95546954bfb745d312e44 Mon Sep 17 00:00:00 2001 From: James Ryan Date: Mon, 14 Feb 2022 15:17:42 +1100 Subject: [PATCH 07/13] fixed directory path --- .github/workflows/build-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index e8729fd..7663405 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -39,4 +39,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: docs - path: doc/_build/html + path: docs/_build/html From d8ba14fe8934d2324d9b894890fd61469ccd132b Mon Sep 17 00:00:00 2001 From: James Ryan Date: Thu, 17 Feb 2022 12:03:46 +1100 Subject: [PATCH 08/13] added sed command to change description.md mp4 --- .github/workflows/build-docs.yml | 4 ++++ .napari/DESCRIPTION.md | 6 ++++-- docs/usage.rst | 1 + setup.cfg | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 7663405..d2fb7a7 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -31,6 +31,10 @@ jobs: - name: Build docs run: | + sed -i 's,https://user-images.githubusercontent.com/17995243/120086403-f1d0b300-c121-11eb-8000-a44a2ac54339.mp4,,g' .napari/DESCRIPTION.md cd docs make html cd .. diff --git a/.napari/DESCRIPTION.md b/.napari/DESCRIPTION.md index 0d0f1a9..2da931a 100644 --- a/.napari/DESCRIPTION.md +++ b/.napari/DESCRIPTION.md @@ -9,8 +9,10 @@ the requisite transformation matrix using Affine Transform, Euclidean Transform, or Similarity Transform, and performs this transformation on the moving image, aligning it to the reference image. -https://user-images.githubusercontent.com/17995243/120086403-f1d0b300-c121-11eb-8000-a44a2ac54339.mp4 - + # Who is This For? diff --git a/docs/usage.rst b/docs/usage.rst index 2ee172f..478e3ea 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -3,3 +3,4 @@ Using affinder .. include:: ../.napari/DESCRIPTION.md :parser: myst_parser.sphinx_ +s diff --git a/setup.cfg b/setup.cfg index 4f88f12..f4eee06 100644 --- a/setup.cfg +++ b/setup.cfg @@ -56,5 +56,6 @@ testing = docs = furo myst-parser + sphinxcontrib-video [options.package_data] affinder = napari.yaml From 11871f8909f5024b0ebf8529c46d99642aa11d0f Mon Sep 17 00:00:00 2001 From: James Ryan Date: Thu, 17 Feb 2022 12:10:24 +1100 Subject: [PATCH 09/13] removed broken sed command, rip --- .github/workflows/build-docs.yml | 4 ---- docs/usage.rst | 1 - 2 files changed, 5 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index d2fb7a7..7663405 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -31,10 +31,6 @@ jobs: - name: Build docs run: | - sed -i 's,https://user-images.githubusercontent.com/17995243/120086403-f1d0b300-c121-11eb-8000-a44a2ac54339.mp4,,g' .napari/DESCRIPTION.md cd docs make html cd .. diff --git a/docs/usage.rst b/docs/usage.rst index 478e3ea..2ee172f 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -3,4 +3,3 @@ Using affinder .. include:: ../.napari/DESCRIPTION.md :parser: myst_parser.sphinx_ -s From 20b3ab68233375933b9f294a3484a749b7d12a3f Mon Sep 17 00:00:00 2001 From: James Ryan Date: Thu, 17 Feb 2022 14:01:55 +1100 Subject: [PATCH 10/13] added python script to replace url in description --- .github/workflows/build-docs.yml | 1 + .github/workflows/deploy-docs.yml | 1 + .napari/DESCRIPTION.md | 6 ++---- docs/replace_description_text.py | 22 ++++++++++++++++++++++ 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 docs/replace_description_text.py diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 7663405..60842a3 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -31,6 +31,7 @@ jobs: - name: Build docs run: | + python docs/replace_description_text.py cd docs make html cd .. diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 185ce72..9aa543e 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -31,6 +31,7 @@ jobs: - name: Build docs run: | + python docs/replace_description_text.py cd docs make html cd .. diff --git a/.napari/DESCRIPTION.md b/.napari/DESCRIPTION.md index 2da931a..0d0f1a9 100644 --- a/.napari/DESCRIPTION.md +++ b/.napari/DESCRIPTION.md @@ -9,10 +9,8 @@ the requisite transformation matrix using Affine Transform, Euclidean Transform, or Similarity Transform, and performs this transformation on the moving image, aligning it to the reference image. - +https://user-images.githubusercontent.com/17995243/120086403-f1d0b300-c121-11eb-8000-a44a2ac54339.mp4 + # Who is This For? diff --git a/docs/replace_description_text.py b/docs/replace_description_text.py new file mode 100644 index 0000000..70ecc98 --- /dev/null +++ b/docs/replace_description_text.py @@ -0,0 +1,22 @@ +""" +for ../.napari/DESCRIPTION.md +find URLs ending in .mp4 and replace URL wraped in HTML video tag +""" + +desc_source = ".napari/DESCRIPTION.md" +desc_file = open(desc_source, 'r') +replacement_url = '\n' +new_text = "" + +for line in desc_file: + if line.strip().startswith("https://user-images.githubusercontent") and line.strip().endswith(".mp4"): + line = replacement_url.format(line.strip()) + new_text += line +desc_file.close() + +desc_file = open(desc_source, 'w') +desc_file.write(new_text) +desc_file.close() From 691b2d764f7a0e3703c8b2c106e1f9a839506f0b Mon Sep 17 00:00:00 2001 From: James Ryan Date: Fri, 18 Feb 2022 13:10:03 +1100 Subject: [PATCH 11/13] tidied up text replacement script --- docs/replace_description_text.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/docs/replace_description_text.py b/docs/replace_description_text.py index 70ecc98..45ddcd6 100644 --- a/docs/replace_description_text.py +++ b/docs/replace_description_text.py @@ -3,20 +3,16 @@ find URLs ending in .mp4 and replace URL wraped in HTML video tag """ -desc_source = ".napari/DESCRIPTION.md" -desc_file = open(desc_source, 'r') replacement_url = '\n' new_text = "" -for line in desc_file: - if line.strip().startswith("https://user-images.githubusercontent") and line.strip().endswith(".mp4"): - line = replacement_url.format(line.strip()) - new_text += line -desc_file.close() - -desc_file = open(desc_source, 'w') -desc_file.write(new_text) -desc_file.close() +with open(".napari/DESCRIPTION.md", 'r+') as desc_file: + for line in desc_file: + if line.strip().startswith("https://user-images.githubusercontent") and line.strip().endswith(".mp4"): + line = replacement_url.format(line.strip()) + new_text += line + desc_file.seek(0) + desc_file.write(new_text) From f4606fcea1d93854b5c3a5dbe2f0a4b3ab202e14 Mon Sep 17 00:00:00 2001 From: James Ryan Date: Thu, 24 Feb 2022 12:02:21 +1100 Subject: [PATCH 12/13] fixed typo --- docs/replace_description_text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/replace_description_text.py b/docs/replace_description_text.py index 45ddcd6..096b26d 100644 --- a/docs/replace_description_text.py +++ b/docs/replace_description_text.py @@ -1,6 +1,6 @@ """ for ../.napari/DESCRIPTION.md -find URLs ending in .mp4 and replace URL wraped in HTML video tag +find URLs ending in .mp4 and replace URL wrapped in HTML video tag """ replacement_url = '