From cef899ad0203ce8683c37175d91dc1af13e17fd5 Mon Sep 17 00:00:00 2001 From: harryswift01 Date: Wed, 10 Dec 2025 17:04:01 +0000 Subject: [PATCH 1/4] introduce `Sphinx` and read the docs to Python template repo --- .readthedocs.yaml | 19 +++++++++++++++++++ docs/Makefile | 20 ++++++++++++++++++++ docs/index.md | 11 ----------- docs/installation.md | 6 ------ docs/make.bat | 35 +++++++++++++++++++++++++++++++++++ docs/source/conf.py | 33 +++++++++++++++++++++++++++++++++ docs/source/index.rst | 16 ++++++++++++++++ 7 files changed, 123 insertions(+), 17 deletions(-) create mode 100644 .readthedocs.yaml create mode 100644 docs/Makefile delete mode 100644 docs/index.md delete mode 100644 docs/installation.md create mode 100644 docs/make.bat create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..289f0af --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,19 @@ +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +version: 2 + +build: + os: ubuntu-24.04 + tools: + python: "3.13" + +sphinx: + configuration: docs/conf.py + +python: + install: + - method: pip + path: . + extra_requirements: + - docs 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/index.md b/docs/index.md deleted file mode 100644 index ef8bdc7..0000000 --- a/docs/index.md +++ /dev/null @@ -1,11 +0,0 @@ -# Project Documentation - -Welcome to **example_package_YOUR_USERNAME_HERE**! - -This is placeholder documentation for your Python package template. - ---- - -## Contents - -- [Installation](installation.md) diff --git a/docs/installation.md b/docs/installation.md deleted file mode 100644 index cb541f8..0000000 --- a/docs/installation.md +++ /dev/null @@ -1,6 +0,0 @@ -# Installation - -## Editable (development) install - -```bash -pip install -e .[pre-commit,testing,docs] diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..747ffb7 --- /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/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..dc97afb --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,33 @@ +# 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 = 'CCPBioSim-Python-Template' +copyright = '2025, CCPBioSim' +author = 'CCPBioSim' +release = '0.0.1' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + 'sphinx.ext.duration', + 'sphinx.ext.doctest', + 'sphinx.ext.autodoc', + 'sphinx.ext.autosummary', +] + +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 = 'furo' +html_static_path = ['_static'] diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..fc5b8b4 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,16 @@ +.. CCPBioSim-Python-Template documentation master file, created by + sphinx-quickstart on Wed Dec 10 16:51:51 2025. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +CCPBioSim-Python-Template documentation +======================================= + +Add your content using ``reStructuredText`` syntax. See the +`reStructuredText `_ +documentation for details. + + +.. toctree:: + :maxdepth: 2 + :caption: Contents: From eedf98c2e7294db51e68edfb3e49b305c078b528 Mon Sep 17 00:00:00 2001 From: harryswift01 Date: Wed, 10 Dec 2025 17:09:13 +0000 Subject: [PATCH 2/4] remove author configuration from `docs/conf.py` --- docs/source/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index dc97afb..e406c95 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -8,7 +8,6 @@ project = 'CCPBioSim-Python-Template' copyright = '2025, CCPBioSim' -author = 'CCPBioSim' release = '0.0.1' # -- General configuration --------------------------------------------------- From 1ed35a35aa8094e2a09b3dbfa9fab7293d24dceb Mon Sep 17 00:00:00 2001 From: harryswift01 Date: Wed, 10 Dec 2025 17:11:33 +0000 Subject: [PATCH 3/4] include more `extensions` within `docs/conf.py` --- docs/source/conf.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index e406c95..4956bc9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -14,12 +14,22 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration extensions = [ - 'sphinx.ext.duration', - 'sphinx.ext.doctest', - 'sphinx.ext.autodoc', - 'sphinx.ext.autosummary', + "sphinx.ext.autosummary", + "sphinx.ext.autodoc", + "sphinx.ext.mathjax", + "sphinx.ext.viewcode", + "sphinx.ext.napoleon", + "sphinx.ext.intersphinx", + "sphinx.ext.extlinks", + "nbsphinx", + "sphinx_copybutton", ] +autosummary_generate = True +napoleon_google_docstring = False +napoleon_use_param = False +napoleon_use_ivar = True + templates_path = ['_templates'] exclude_patterns = [] From c6e444a7a11962d06f0ef849b7d0be5682bd9447 Mon Sep 17 00:00:00 2001 From: harryswift01 Date: Wed, 10 Dec 2025 17:14:29 +0000 Subject: [PATCH 4/4] reintroduce building of docs within `.github/workflows/example_package_project-ci.yaml` --- .github/workflows/example_package_project-ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/example_package_project-ci.yaml b/.github/workflows/example_package_project-ci.yaml index b926b48..b333e26 100644 --- a/.github/workflows/example_package_project-ci.yaml +++ b/.github/workflows/example_package_project-ci.yaml @@ -49,8 +49,8 @@ jobs: run: | pip install --upgrade pip pip install -e .[docs] - # - name: Build docs - # run: cd docs && make + - name: Build docs + run: cd docs && make pre-commit: runs-on: ubuntu-24.04