diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml deleted file mode 100644 index ef65392..0000000 --- a/.github/workflows/book.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Deploy documentation - -on: - push: - branches: - # - main - - docs - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: realtabformer-env - environment-file: environment.yml - python-version: 3.9 - auto-activate-base: false - - name: Dependencies - shell: bash -l {0} - run: | - conda install pip - if [ -f docs/requirements.txt ]; then pip install -r docs/requirements.txt; fi - - name: Build - shell: bash -l {0} - run: | - jupyter-book build . --config docs/_config.yml --toc docs/_toc.yml - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - if: github.ref == 'refs/heads/main' && job.status == 'success' - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./_build/html - enable_jekyll: false diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 0000000..4b5ae03 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -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 diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..e8c0a2d --- /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 = . +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) \ No newline at end of file diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index 9e16e52..0000000 --- a/docs/_config.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Book settings -# https://jupyterbook.org/en/stable/customize/config.html -title: REaLTabFormer for Synthetic Data Generation -author: Aivin V. Solatorio -# logo: docs/images/logo.png - -repository: - url: https://github.com/avsolatorio/REaLTabFormer - branch: main - -html: - home_page_in_navbar: false - extra_navbar: "" - use_edit_page_button: true - use_repository_button: true - use_issues_button: true - baseurl: https://avsolatorio.github.io/REaLTabFormer - -only_build_toc_files: true - -execute: - execute_notebooks : off diff --git a/docs/_toc.yml b/docs/_toc.yml deleted file mode 100644 index 39e5e34..0000000 --- a/docs/_toc.yml +++ /dev/null @@ -1,8 +0,0 @@ -format: jb-book -root: README - -parts: - - caption: Experiments - numbered: True - chapters: - - file: "experiments/notebooks/Model Experiments.ipynb" diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..fc3e1cb --- /dev/null +++ b/docs/conf.py @@ -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()}" + }, +} diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..565c9e0 --- /dev/null +++ b/docs/index.rst @@ -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 \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt index 90be2fb..21a254d 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -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