Skip to content

Commit

Permalink
Revive the HEXRD readthedocs documentation
Browse files Browse the repository at this point in the history
A lot has changed since the documentation was last generated 6 years ago,
including sphinx and its extensions. Automatic documentation is now simpler,
so a lot of files previously present were no longer needed and are deleted in
this commit.

The process of generating the documentation is now quite simple. See the
`docs/README.md` file for more info.

This overall seems to generate the documentation correctly.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
  • Loading branch information
psavery committed Aug 21, 2023
1 parent d1de88a commit 1e6dcc2
Show file tree
Hide file tree
Showing 20 changed files with 115 additions and 1,202 deletions.
19 changes: 19 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2

sphinx:
configuration: docs/source/conf.py

python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .

build:
os: ubuntu-22.04
tools:
python: '3.10'
jobs:
pre_build:
# Run the apidoc command to generate the initial module files
- docs/run_apidoc.sh
4 changes: 2 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
Expand Down
14 changes: 14 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
HEXRD Documentation
===================

The HEXRD documentation utilizes sphinx along with sphinx-apidoc to
automatically generate documentation for all of the HEXRD packages.

Manually created files may be added as well in either RST or Markdown format.
See the files in `source/users` as an example.

To build the documentation locally, first install the dependencies in the
`requirements.txt` file, then run the `run_sphinx.sh` script. The HTML files
should be automatically generated and placed inside `build/html`. Open up
the `build/html/index.html` file in a web browser to view the generated
content.
28 changes: 0 additions & 28 deletions docs/README.rst

This file was deleted.

64 changes: 0 additions & 64 deletions docs/autogen_api.py

This file was deleted.

112 changes: 0 additions & 112 deletions docs/build.rst

This file was deleted.

55 changes: 0 additions & 55 deletions docs/conf.py

This file was deleted.

20 changes: 0 additions & 20 deletions docs/index.rst

This file was deleted.

35 changes: 0 additions & 35 deletions docs/make.bat

This file was deleted.

8 changes: 8 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Pin sphinx to be less than 7 until new sphinx-rtd-theme comes out: https://github.com/readthedocs/readthedocs.org/issues/10279#issuecomment-1529988748
sphinx<7
pygments
sphinx-rtd-theme
myst-parser

# We need matplotlib for some of the documentation
matplotlib
17 changes: 17 additions & 0 deletions docs/run_apidoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

SCRIPT_DIR=`dirname "$0"`
pushd .
cd $SCRIPT_DIR

# sphinx-apidoc argument explanation:
# -d 1 - only use a depth of one for table of contents (TOC)
# -T - don't generate the modules.rst TOC file
# -e - put documentation for each module on its own page
# -f - overwrite previously existing files
# -o source/ - place the output files into the source directory
# ../hexrd - the path to the root source directory
# Extra arguments at the end are exclude patterns
sphinx-apidoc -d 1 -T -e -f -o source/ ../hexrd

popd
Loading

0 comments on commit 1e6dcc2

Please sign in to comment.