Skip to content

Commit

Permalink
Include Documentation (#20)
Browse files Browse the repository at this point in the history
* Migrate to sphinx-book-theme

* Update publish workflow
  • Loading branch information
g4brielvs authored Jun 8, 2023
1 parent df53689 commit e6586a5
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 66 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/book.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish Documentation on GitHub Pages

on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
- name: Dependencies
run: |
if [ -f docs/requirements.txt ]; then pip install -r docs/requirements.txt; fi
- name: Build Sphinx Documentation
run: |
sphinx-build docs docs/_build/html
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: job.status == 'success'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
enable_jekyll: false
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
rm -rf _build
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
22 changes: 0 additions & 22 deletions docs/_config.yml

This file was deleted.

8 changes: 0 additions & 8 deletions docs/_toc.yml

This file was deleted.

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.
import os
import sys

from pathlib import Path

# -- Project information
project = "REaLTabFormer"
copyright = "2023, World Bank"
author = "Aivin Solatorio"

# -- General configuration
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"autoapi.extension",
"myst_nb",
"sphinx_autodoc_typehints",
]
autoapi_dirs = ["../src"]

intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
}
source_suffix = [".rst", ".md"]
templates_path = ["_templates"]

html_logo = "../img/REalTabFormer_Final_EQ.png"
html_title = "REaLTabFormer"

html_theme = "sphinx_book_theme"
html_theme_options = {
"repository_url": "https://github.com/worldbank/realtabformer",
"use_repository_button": True,
"use_issues_button": True,
"use_edit_page_button": True,
"logo": {
"text": f"REaLTabFormer {(Path(__file__).parent.parent / 'src' / 'realtabformer'/ 'VERSION').read_text().strip()}"
},
}
16 changes: 16 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. REaLTabFormer documentation master file, created by
sphinx-quickstart on Wed Jun 7 18:23:38 2023.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. include:: ../README.md
:parser: myst_parser.sphinx_

Documentation
=============

.. toctree::
:maxdepth: 4
:caption: Contents

self
6 changes: 5 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
jupyter-book>=0.12.0
myst-nb==0.17.2
Sphinx==5.3.0
sphinx-autodoc-typehints==1.19.1
sphinx-autoapi==2.1.0
sphinx-book-theme==1.0.1

0 comments on commit e6586a5

Please sign in to comment.