Skip to content

Commit 1db8c2a

Browse files
authored
Merge pull request #36 from EXP-code/Doxygen
Generate the XML files needed by Sphinx+Breathe from Doxgyen at build time
2 parents 3e0a81a + abaad58 commit 1db8c2a

File tree

605 files changed

+135
-236857
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

605 files changed

+135
-236857
lines changed

.github/workflows/build_docs.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Build and Deploy Sphinx Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Trigger on pushes to the main branch
7+
- Doxygen # Trigger on pushes to the devel branch
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-24.04 # Specify the operating system
12+
13+
steps:
14+
- uses: actions/checkout@v4 # Checkout the repository
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.x' # Specify your Python version
19+
- name: Install dependencies
20+
run: |
21+
sudo apt-get update
22+
sudo apt-get install -y build-essential libeigen3-dev libfftw3-dev libhdf5-dev libopenmpi-dev libomp-dev python3-numpy python3-venv python3-ipython ipython3 doxygen graphviz cmake make pandoc
23+
python3 -m venv .venv # Create a virtual environment
24+
source .venv/bin/activate # Activate the environment
25+
pip install sphinx sphinx-rtd-theme # Install Sphinx and theme
26+
pip install -r requirements.txt # Install any additional dependencies (optional)
27+
- name: Build Sphinx documentation
28+
run: |
29+
source .venv/bin/activate # Activate the environment
30+
make html # Build the HTML documentation
31+
- name: Upload built documentation (optional)
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: html-docs
35+
path: _build/html # Path to your built documentation
36+
- name: Deploy to GitHub Pages
37+
uses: peaceiris/actions-gh-pages@v3
38+
if: ${{ github.event_name == 'push' }}
39+
with:
40+
publish_branch: gh-pages
41+
github_token: ${{ secrets.GITHUB_TOKEN }}
42+
publish_dir: _build/html
43+
force_orphan: true

.readthedocs.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,23 @@ version: 2
66

77
# Set the OS, Python version and other tools you might need
88
build:
9-
os: ubuntu-22.04
9+
os: ubuntu-24.04
1010
tools:
11-
python: "3.11"
11+
python: "3.12"
1212
# You can also specify other tool versions:
1313
# nodejs: "20"
1414
# rust: "1.70"
1515
# golang: "1.20"
1616
apt_packages:
1717
- graphviz
18+
- cmake
19+
- make
20+
- libeigen3-dev
21+
- libfftw3-dev
22+
- libhdf5-dev
23+
- libopenmpi-dev
24+
- openmpi-bin
25+
- openmpi-common
1826

1927
# Build documentation in the "docs/" directory with Sphinx
2028
sphinx:

conf.py

Lines changed: 73 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,78 @@
33
# For the full list of built-in configuration values, see the documentation:
44
# https://www.sphinx-doc.org/en/master/usage/configuration.html
55

6-
# -- Project information -----------------------------------------------------
7-
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
6+
import os, sys
7+
import subprocess
88

9+
on_rtd = os.environ.get("READTHEDOCS") == "True"
10+
11+
12+
# -- Generate doxygen xml prior to build --------------------------------------
13+
14+
# Define the repository URL and target directory
15+
#
16+
repo_url = "https://github.com/EXP-code/EXP.git"
17+
clone_dir = "exp_repo"
18+
branch = "SLboundaries"
19+
doxyfile = "exp.cfg.breathe"
20+
doxy_dir = "doc"
21+
22+
# Cache the current working directory
23+
#
24+
build_dir = os.getcwd()
25+
26+
# Clone the EXP repository if it doesn't exist
27+
#
28+
if not os.path.exists(clone_dir):
29+
subprocess.run(["git", "clone", repo_url, clone_dir], check=True)
30+
31+
# Move to source and get the desired branch
32+
#
33+
os.chdir(clone_dir)
34+
subprocess.run(["git", "checkout", branch])
35+
subprocess.run(["cp", "CMakeLists.txt", "CMakeLists.txt.orig"])
36+
command = ["sed", "-i", "-e", 's/VERSION 3.25/VERSION 3.22/g', "CMakeLists.txt"]
37+
result = subprocess.run(command, capture_output=True, text=True, check=True)
38+
39+
# Initialize submodules
40+
#
41+
os.chdir(doxy_dir)
42+
os.system("git submodule update --init --recursive")
43+
44+
# Ensure Doxygen is installed and its executable is in your PATH
45+
#
46+
subprocess.run(["doxygen", doxyfile], check=True)
47+
48+
if not on_rtd:
49+
# Build pyEXP to populate Python API documenation
50+
#
51+
os.chdir('..')
52+
53+
# Make build directory and begin
54+
#
55+
if not os.path.exists('build'):
56+
subprocess.run(["mkdir", "build"], check=True)
57+
os.chdir('build')
58+
subprocess.run(['cmake', '-DCMAKE_BUILD_TYPE=Release -DENABLE_USER=NO -DENABLE_NBODY=NO -DEigen3_DIR=$EIGEN_BASE/share/eigen3/cmake -Wno-dev', '..'])
59+
subprocess.run(['make', '-j8'])
60+
61+
# Return to top level
62+
#
63+
os.chdir(build_dir)
64+
65+
# Add 'my_module_path' to the beginning of sys.path
66+
#
67+
my_module_path = os.path.join(build_dir, 'exp_repo/build/pyEXP')
68+
sys.path.insert(0, my_module_path)
69+
70+
# Begin Sphinx configuration
71+
72+
# -- project information -----------------------------------------------------
73+
#
974
project = 'EXP'
1075
copyright = '2023-2025, EXP-code collaboration'
1176
author = 'EXP-code collaboration'
12-
release = '0.16'
77+
release = '0.17'
1378
version = '7.x'
1479

1580
# -- General configuration ---------------------------------------------------
@@ -36,7 +101,7 @@
36101
templates_path = ['_templates']
37102
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'README.rst']
38103

39-
breathe_projects = {"EXP": "doxyxml/"}
104+
breathe_projects = {"EXP": "exp_repo/doc/xml/"}
40105
breathe_default_project = "EXP"
41106

42107
# -- Options for HTML output -------------------------------------------------
@@ -46,14 +111,16 @@
46111
html_logo = 'exp_logo_white.png'
47112
html_static_path = ['_static']
48113

114+
# -- A readthedocs conditional ----------------------------------------------
115+
if on_rtd:
116+
tags.add('rtd')
117+
49118
# -- Turn on figure numering -------------------------------------------------
50119
numfig = True
51120

52121
# -- Extension configuration -------------------------------------------------
53122
nbsphinx_execute = 'never'
54123

55124
# -- Grab files from pyEXP-examples -----------------------------------------
56-
import os
57-
58125
os.system("cd intro/Tutorials; rm *ipynb*; wget -L https://raw.githubusercontent.com/EXP-code/pyEXP-examples/refs/heads/main/Tutorials/Introduction/Part1-Coefficients.ipynb; wget -L https://raw.githubusercontent.com/EXP-code/pyEXP-examples/refs/heads/main/Tutorials/Introduction/Part2-Analysis.ipynb")
59126

0 commit comments

Comments
 (0)