Skip to content

Commit

Permalink
Build docs with Sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
JoKra1 committed Sep 30, 2024
1 parent b224f45 commit 7c448f4
Show file tree
Hide file tree
Showing 17 changed files with 1,044 additions and 475 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Based on https://github.com/actions/starter-workflows/blob/main/pages/static.yml
name: documentation

on:
push:
branches: [$default-branch]
workflow_dispatch:

permissions:
contents: write
pages: write
id-token: write

jobs:
docs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python for Docs
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install sphinx
run: |
python -m pip install --upgrade pip
pip install sphinx sphinx-rtd-theme
- name: Build Docs
run: |
sphinx-build docs docs/_build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './docs/_build'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
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 = .
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)
43 changes: 43 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 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

# path
import os
import sys

sys.path.insert(0, os.path.abspath('..'))

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'mssm'
copyright = '2024, Joshua Krause'
author = 'Joshua Krause'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ['sphinx.ext.autodoc']

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'

html_theme_options = {

# Toc options
'collapse_navigation': True,
'sticky_navigation': True,
'navigation_depth': 8
}


html_static_path = ['_static']
28 changes: 28 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.. mssm documentation master file, created by
sphinx-quickstart on Fri Sep 27 15:37:49 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
mssm documentation
==================

This is the documentation for the **exposed** API of ``mssm``. The source code for internal functions is available on `GitHub <https://github.com/JoKra1/mssm>`_ and can be
consulted to understand their implementation. ``mssm`` is a toolbox to estimate Generalized Additive Mixed Models (GAMMs), Generalized Additive Mixed Models of Location Scale
and Shape (GAMMLSS), and more general (mixed) smooth models in the sense defined by `Wood, Pya, & Säfken (2016) <https://doi.org/10.1080/01621459.2016.1180986>`_.
mssm is an excellent choice for the modeling of multi-level time-series data, often estimating additive models with separate smooths for thousands of levels in a couple of minutes.

Currently, ``mssm`` supports Gaussian (G)AMMs (:func:`mssm.src.python.exp_fam.Gaussian`), Gamma GAMMs (:func:`mssm.src.python.exp_fam.Gamma`), and Binomial GAMMs (:func:`mssm.src.python.exp_fam.Binomial`).
For GAMMLSS models, Gaussian models (:func:`mssm.src.python.exp_fam.GAUMLSS`), Gamma models (:func:`mssm.src.python.exp_fam.GAMMALS`), and Multionimal models (:func:`mssm.src.python.exp_fam.MULNOMLSS`) are supported.

If you are missing a family, don't worry - all you need to do is to implement the :func:`mssm.src.python.exp_fam.Family` template class for GAMM models and the :func:`mssm.src.python.exp_fam.GAMLSSFamily` template class for GAMMLSS models.
To estimate the most general kind of smooth model, you only have to implement the :func:`mssm.src.python.exp_fam.GENSMOOTHFamily` template class.

To get started with ``mssm`` the tutorial and visualization code available `here <https://github.com/JoKra1/mssm_tutorials>`_ might also be helpful.



.. toctree::
:maxdepth: 2
:caption: Contents:

modules
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
7 changes: 7 additions & 0 deletions docs/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
src
===

.. toctree::
:maxdepth: 4

mssm
22 changes: 22 additions & 0 deletions docs/mssm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
mssm package
============

Subpackages
-----------

.. toctree::
:maxdepth: 4

mssm.src

Submodules
----------

mssm.models module
------------------

.. automodule:: mssm.models
:members:
:undoc-members:
:show-inheritance:

53 changes: 53 additions & 0 deletions docs/mssm.src.python.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
mssm.src.python package
=======================

Submodules
----------

mssm.src.python.compare module
------------------------------

.. automodule:: mssm.src.python.compare
:members:
:undoc-members:
:show-inheritance:

mssm.src.python.constraints module
----------------------------------

.. automodule:: mssm.src.python.constraints
:members:
:undoc-members:
:show-inheritance:

mssm.src.python.exp\_fam module
-------------------------------

.. automodule:: mssm.src.python.exp_fam
:members:
:undoc-members:
:show-inheritance:

mssm.src.python.formula module
------------------------------

.. automodule:: mssm.src.python.formula
:members: Formula, VarType,lhs,reparam
:undoc-members:
:show-inheritance:

mssm.src.python.terms module
----------------------------

.. automodule:: mssm.src.python.terms
:members:
:undoc-members:
:show-inheritance:

mssm.src.python.utils module
----------------------------

.. automodule:: mssm.src.python.utils
:members:
:undoc-members:
:show-inheritance:
10 changes: 10 additions & 0 deletions docs/mssm.src.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
mssm.src package
================

Subpackages
-----------

.. toctree::
:maxdepth: 4

mssm.src.python
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ before-test = "ls"
skip = ["pp*","cp313-musllinux*"]
test-skip = "*-win32 *i686"
test-requires = ["pytest", "pytest-cov", "mssmViz", "numdifftools"]
test-command = "pytest {project}/tests -k-hard --cov={project}"
test-command = 'pytest {project}/tests -k "not _hard" --cov={project}'

[project]
dependencies=["numpy >= 1.24.1",
Expand Down
Loading

0 comments on commit 7c448f4

Please sign in to comment.