Skip to content

Commit

Permalink
Create autobuilding docs (#41)
Browse files Browse the repository at this point in the history
* docs skeleton with rtd theme

* docs with notebook

* publish docs to gh pages
  • Loading branch information
callumrollo authored Oct 29, 2024
1 parent b33c6b3 commit e9f2d7f
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 2 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -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

20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -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)
Binary file added docs/source/_static/glider.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -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"]
7 changes: 7 additions & 0 deletions docs/source/glidertest.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:mod:`glidertest API`
-----------------------

.. automodule:: glidertest.tools
:members:
:undoc-members:
:show-inheritance:
22 changes: 22 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -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`
11 changes: 9 additions & 2 deletions notebooks/demo.ipynb
Original file line number Diff line number Diff line change
@@ -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."
Expand Down Expand Up @@ -347,7 +354,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand Down
4 changes: 4 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ skyfield
tqdm
jupyterlab
pytest
nbsphinx
nbconvert
sphinx
sphinx-rtd-theme

0 comments on commit e9f2d7f

Please sign in to comment.