diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..ddc54d2 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,53 @@ +name: Documentation + +on: + pull_request: + push: + branches: + - main + release: + types: + - published + +jobs: + build-docs: + runs-on: ubuntu-latest + + steps: + - name: checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Micromamba ${{ matrix.python-version }} + uses: mamba-org/setup-micromamba@v2 + with: + environment-name: TEST + init-shell: bash + create-args: >- + python=3 pip + --file requirements-dev.txt + --channel conda-forge + + - name: Install glidertest + shell: bash -l {0} + run: | + python -m pip install -e . --no-deps --force-reinstall + + - name: Build documentation + shell: bash -l {0} + run: | + set -e + jupyter nbconvert --to notebook --execute notebooks/demo.ipynb --output=demo-output.ipynb + mv notebooks/*output.ipynb docs/source/ + pushd docs + make clean html + popd + + - name: Deploy + if: success() && github.event_name == 'release' + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/build/html + diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/source/_static/glider.jpg b/docs/source/_static/glider.jpg new file mode 100644 index 0000000..a69e0e4 Binary files /dev/null and b/docs/source/_static/glider.jpg differ diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..f771370 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,41 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information +import datetime + +year = datetime.datetime.now(tz=datetime.timezone.utc).date().year + +# General information about the project. +project = 'glidertest' +author = 'Callum Rollo' +copyright = f"{year}, {author}" +release = 'v0.0.1' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.viewcode", + "sphinx.ext.napoleon", + "nbsphinx", +] + + + +templates_path = ['_templates'] +exclude_patterns = [] + + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'sphinx_rtd_theme' +html_static_path = ['_static'] + +source_suffix = [".rst", ".md"] diff --git a/docs/source/glidertest.rst b/docs/source/glidertest.rst new file mode 100644 index 0000000..2504071 --- /dev/null +++ b/docs/source/glidertest.rst @@ -0,0 +1,7 @@ +:mod:`glidertest API` +----------------------- + +.. automodule:: glidertest.tools + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..6e705be --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,22 @@ +.. glidertest documentation master file, created by + sphinx-quickstart on Tue Oct 29 11:30:19 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to glidertest's documentation! +====================================== + +.. toctree:: + :maxdepth: 3 + :caption: Contents: + + demo-output.ipynb + glidertest + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/notebooks/demo.ipynb b/notebooks/demo.ipynb index d6082b2..1cf834b 100644 --- a/notebooks/demo.ipynb +++ b/notebooks/demo.ipynb @@ -1,11 +1,18 @@ { "cells": [ + { + "cell_type": "markdown", + "id": "c6a29764-f39c-431c-8e77-fbc6bfe20f01", + "metadata": {}, + "source": [ + "# Glidertest demo " + ] + }, { "cell_type": "markdown", "id": "97e9729d-4db2-419c-bbc2-a2078fc9b7dc", "metadata": {}, "source": [ - "## Glidertest demo \n", "\n", "The purpose of this notebook is to demostrate the functionality of glidertests functions. \n", "This notebooks can be used to diagnose issues within your glider data. We have added suggested processing in some cases." @@ -347,7 +354,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, diff --git a/requirements-dev.txt b/requirements-dev.txt index 905696d..78e2856 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -12,3 +12,7 @@ skyfield tqdm jupyterlab pytest +nbsphinx +nbconvert +sphinx +sphinx-rtd-theme