Skip to content

Commit

Permalink
Merge pull request #7 from sandialabs/read-the-docs
Browse files Browse the repository at this point in the history
docs: Prepare for ReadTheDocs
  • Loading branch information
jmgate authored Feb 15, 2024
2 parents 9ae79f6 + a96e8ae commit 2108da3
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 35 deletions.
26 changes: 26 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Read the Docs configuration file for Sphinx projects.
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for
# details.

# Required.
version: 2

# Set the OS, Python version, and other tools you need.
build:
os: "ubuntu-22.04"
tools:
python: "3.9"

# Build documentation in the "doc/" directory with Sphinx.
sphinx:
fail_on_warning: true
configuration: doc/source/conf.py

# Declare Python requirements for building the documentation.
python:
install:
- method: pip
path: .
- requirements: requirements.txt
- requirements: doc/requirements.txt
- requirements: example/requirements.txt
20 changes: 20 additions & 0 deletions doc/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)
11 changes: 11 additions & 0 deletions doc/make-html.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
ORIG_DIR=$(pwd)
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
cd "${SCRIPT_DIR}" || exit 1
make clean
python3 -m pip uninstall -y shell-logger
cd ..
python3 -m pip install .
cd "${SCRIPT_DIR}" || exit 1
make html
cd "${ORIG_DIR}" || exit 1
9 changes: 0 additions & 9 deletions doc/make_html_docs.sh

This file was deleted.

6 changes: 5 additions & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Requirements for building the `ShellLogger` documentation.
# Requirements for building the `shell-logger` documentation.

sphinx
sphinx-argparse
sphinx-autodoc-typehints
sphinx-copybutton
sphinx-rtd-theme
sphinxcontrib-programoutput
sphinxcontrib-spelling
Empty file added doc/source/_static/.gitkeep
Empty file.
36 changes: 11 additions & 25 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
#!/usr/bin/env python3
"""
Configuration file for the Sphinx documentation builder.
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
For the full list of built-in configuration values, see the documentation:
https://www.sphinx-doc.org/en/master/usage/configuration.html
"""
from pathlib import Path
import sys

Expand All @@ -31,9 +23,6 @@

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named `sphinx.ext.*`) or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.coverage",
Expand All @@ -43,24 +32,21 @@
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinxarg.ext",
"sphinx_autodoc_typehints",
"sphinx_copybutton",
"sphinx_rtd_theme",
"sphinxcontrib.programoutput",
"sphinxcontrib.spelling",
]
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]

# -- AutoDoc Configuration ---------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions example/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Requirements for running the `shell-logger` examples.

0 comments on commit 2108da3

Please sign in to comment.