From c31cf91e8dbd041a7c3a7c38d06acc2b185780f2 Mon Sep 17 00:00:00 2001 From: Jordan Maxwell Date: Wed, 13 Nov 2024 17:19:14 -0600 Subject: [PATCH] Added documentation starter project (#2) * Initial changes * Updated Docs * Misc. changes * Adjustments * Move to GH pages --- .github/workflows/sphinx-docs.yml | 22 ++++++++++++++++++ docs/Makefile | 20 ++++++++++++++++ docs/make.bat | 35 ++++++++++++++++++++++++++++ docs/requirements.txt | 3 +++ docs/source/conf.py | 38 +++++++++++++++++++++++++++++++ docs/source/index.rst | 19 ++++++++++++++++ 6 files changed, 137 insertions(+) create mode 100644 .github/workflows/sphinx-docs.yml create mode 100644 docs/Makefile create mode 100644 docs/make.bat create mode 100644 docs/requirements.txt create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst diff --git a/.github/workflows/sphinx-docs.yml b/.github/workflows/sphinx-docs.yml new file mode 100644 index 0000000..c86ad07 --- /dev/null +++ b/.github/workflows/sphinx-docs.yml @@ -0,0 +1,22 @@ +name: Deploy Sphinx documentation to Pages +on: + push: + branches: [main] # branch to trigger deployment + +jobs: + pages: + runs-on: ubuntu-20.04 + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + permissions: + pages: write + id-token: write + + steps: + - id: deployment + uses: sphinx-notes/pages@v3 + with: + documentation_path: docs/source + requirements_path: docs/requirements.txt \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /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 = 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) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..dc1312a --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +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 diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..76d7bb2 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,3 @@ +sphinx +sphinx-autobuild +sphinx_rtd_theme \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..5d71df9 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,38 @@ +# 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 + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = 'Panda3D Astron' +copyright = '2024, Jordan Maxwell' +author = 'Jordan Maxwell' +release = '1.0.0' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + 'sphinx.ext.autodoc', # For pulling in docstrings + 'sphinx.ext.napoleon', # For Google or NumPy style docstrings (optional) + 'sphinx_rtd_theme' # For the Read the Docs theme +] + +templates_path = ['_templates'] +exclude_patterns = [] + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = "sphinx_rtd_theme" +html_static_path = ['_static'] + +# -- Path setup -------------------------------------------------------------- +# If extensions are in another directory, add that directory to sys.path. + +import os +import sys + +sys.path.insert(0, os.path.abspath('..')) diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..074ca87 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,19 @@ +.. Panda3D Astron documentation master file, created by + sphinx-quickstart on Wed Nov 13 16:55:12 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Panda3D Astron documentation +============================ + +Add your content using ``reStructuredText`` syntax. See the +`reStructuredText `_ +documentation for details. + + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + +.. automodule:: panda3d_astron + :members: