Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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: |
python docs/replace_description_text.py
cd docs
make html
cd ..

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: docs
path: docs/_build/html
43 changes: 43 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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: |
python docs/replace_description_text.py
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
7 changes: 4 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@
# ones.
extensions = [
'sphinx.ext.ifconfig',
'myst_parser',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# 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'
Expand Down Expand Up @@ -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 = '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
Expand Down
7 changes: 5 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
Welcome to affinder's documentation!
===============================================================

Contents:

.. toctree::
:maxdepth: 2

usage


.. include:: ../README.md
:parser: myst_parser.sphinx_


Indices and tables
Expand Down
18 changes: 18 additions & 0 deletions docs/replace_description_text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
for ../.napari/DESCRIPTION.md
find URLs ending in .mp4 and replace URL wrapped in HTML video tag
"""

replacement_url = '<video width="640" height="480" controls>\n\
<source src="{}" type="video/mp4">\n\
Your browser does not support the video tag.\n\
</video>\n'
new_text = ""

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)
5 changes: 5 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Using affinder
==============

.. include:: ../.napari/DESCRIPTION.md
:parser: myst_parser.sphinx_
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ testing =
pytest-qt
scikit-image[data]
napari[pyqt5]
zarr

docs =
furo
myst-parser
[options.package_data]
affinder = napari.yaml