Skip to content

Commit

Permalink
docs: Update readthedocs config to use Python 3.10; Add macOS version…
Browse files Browse the repository at this point in the history
… of docs generation script; Add instructions to BUILDING.md describing how to build documentation locally
  • Loading branch information
selimnairb committed Dec 14, 2024
1 parent 3b1bbbe commit 029aaf0
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ conda:
build:
os: ubuntu-22.04
tools:
python: "3.9"
python: "3.10"
commands:
- bash docs/readthedocs/build.bash

Expand All @@ -21,8 +21,8 @@ build:
# configuration: docs/readthedocs/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
formats:
- pdf
#formats:
# - pdf

# Optionally declare the Python requirements required to build your docs
#python:
Expand Down
26 changes: 26 additions & 0 deletions docs/BUILDING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Build instructions

## Documentation
Documentation are automatically created and published at
[readthedocs](https://bag.readthedocs.io). However, if you would like to
build the documentation locally, this can easily be done using scripts
for [Linux](readthedocs/build.bash) or [macOS](readthedocs/build-macos.bash).
Make sure to run these from the root of the repository.

Once the docs are built, you can access them in the directory
`_readthedocs/html`.

To build a PDF of the FSD, run:
```shell
cd _readthedocs/html/fsd
pandoc --pdf-engine=xelatex \
index.html FSD-BAGStructure.html FSD-Encapsulation.html \
FSD-AxiomaticDefs.html FSD-BAGARB.html FSD-RevisionControl.html \
FSD-Extensions.html FSD-Glossary.html FSD-References.html \
FSD-Appendices.html RevisionHistory.html -o BAG_FSD_2.0.3.pdf
```

## Docker
You can build a development Linux container using
[Dockerfile.dev](../Dockerfile.dev) by running the following command from the
Expand All @@ -8,6 +28,12 @@ repository root directory:
docker buildx build -t dev/debian/baglib:latest -f Dockerfile.dev .
```

To build for a specific architecture, such as AMD64, run:
```shell
docker buildx build --platform=linux/amd64 \
-t dev/debian/amd64/baglib:latest -f Dockerfile.dev .
```

To manually build and test inside the development container, run:
```shell
docker run -ti -v ./:/tmp/bag:rw dev/debian/baglib:latest /bin/bash
Expand Down
13 changes: 13 additions & 0 deletions docs/readthedocs/build-macos.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -O miniconda.sh
bash miniconda.sh -b -p $(pwd)/miniconda
source "$(pwd)/miniconda/etc/profile.d/conda.sh"
hash -r
conda env create -q --file docs/readthedocs/environment-macos.yml
conda activate readthedocs
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -B doc-build -S . -DPython3_FIND_STRATEGY=LOCATION -DBAG_BUILD_PYTHON:BOOL=ON -DBAG_BUILD_DOCS:BOOL=ON
cmake --build doc-build -v
mkdir -p _readthedocs/html/
ls -R doc-build/docs/sphinx
cp -r doc-build/docs/sphinx/* _readthedocs/html/
ls -R _readthedocs/html
8 changes: 4 additions & 4 deletions docs/readthedocs/build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ source "$(pwd)/miniconda/etc/profile.d/conda.sh"
hash -r
conda env create -q --file docs/readthedocs/environment.yml
conda activate readthedocs
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -B build -S . -DBAG_BUILD_PYTHON:BOOL=ON -DBAG_BUILD_DOCS:BOOL=ON
cmake --build build -v
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -B doc-build -S . -DPython3_FIND_STRATEGY=LOCATION -DBAG_BUILD_PYTHON:BOOL=ON -DBAG_BUILD_DOCS:BOOL=ON
cmake --build doc-build -v
mkdir -p _readthedocs/html/
ls -R build/docs/sphinx
cp -r build/docs/sphinx/* _readthedocs/html/
ls -R doc-build/docs/sphinx
cp -r doc-build/docs/sphinx/* _readthedocs/html/
ls -R _readthedocs/html
20 changes: 20 additions & 0 deletions docs/readthedocs/environment-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: readthedocs
channels:
- conda-forge
dependencies:
- python=3.9
- clangxx_osx-arm64
- cmake
- ninja
- hdf5-static
- libxml2
- swig
- catch2
- unittest-xml-reporting
- doxygen
- Sphinx=6.2.1
- numpydoc
- breathe
- myst-parser
- sphinx-automodapi
- graphviz
1 change: 1 addition & 0 deletions docs/readthedocs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
- swig
- catch2
- unittest-xml-reporting
- doxygen
- Sphinx=6.2.1
- numpydoc
- breathe
Expand Down
4 changes: 2 additions & 2 deletions docs/sphinx/source/fsd/FSD-Extension-VRGrid.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ file.
low resolution surface is georeferenced on the southwest corner, and is point
referenced. Although not shown here, refined nodes may occupy the east/north
bound of the enclosing cell, but not the west/south bound. Note here that
*N<sub>H,N</sub>*(*i*, *j*) = 8, since refined depths are computed at the
intersections of the grid lines, and *<sub>H,N</sub>*(*i*,*j*) > 0 is
delta*N<sub>H,N</sub>*(*i*, *j*) = 8, since refined depths are computed at the
intersections of the grid lines, and delta*<sub>H,N</sub>*(*i*,*j*) > 0 is
required to avoid duplication of points on the edges of the low resolution
cells.

Expand Down
1 change: 0 additions & 1 deletion docs/sphinx/source/fsd/RevisionHistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@
| 1.6.2 CR1 | Added clarification on the interpretation of datum transform parameters | 2017-08-29 |
| 1.6.3 | Restored the "extension layers" information from 1.5.1 that inexplicably were lost in the move to 1.6.0 | 2018-05-02 |
| 2.0.1 | Added support for georeferenced metadata; Migrate C API to C++14; Add Python API. | 2022-12-01 |
| ![Block Marker](thin-strip.gif) | | ![Block Marker](thin-strip.gif) |

0 comments on commit 029aaf0

Please sign in to comment.