Skip to content

Commit 9ea926d

Browse files
authored
Merge pull request #94 from sandialabs/sphinx-doc-attempt
Sphinx doc attempt (merge after testing refactoring)
2 parents 4122fa2 + 71a158a commit 9ea926d

File tree

8 files changed

+143
-1
lines changed

8 files changed

+143
-1
lines changed

.github/workflows/ci-build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ jobs:
3636
pip install -e ".[sparse,test]"
3737
python -m pytest -n auto optimism --cov=optimism -Wignore
3838
# we can also add the flag -n auto for parallel testing
39+
- name: docs
40+
run: |
41+
pip install -e ".[docs,sparse,test]"
42+
cd docs
43+
sphinx-apidoc -o source/ ../optimism -P
44+
make html
45+
- name: Deploy to GitHub Pages
46+
uses: peaceiris/actions-gh-pages@v3
47+
with:
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
publish_dir: docs/build/html # Adjust this if your output directory is different
50+
publish_branch: gh-pages # The branch to deploy to
3951
- name: codecov
4052
uses: codecov/codecov-action@v4
4153
with:

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,8 @@ spack.lock
2727
.spack-env/
2828
*.npz
2929
*.vtk
30+
31+
# docs stuff
32+
build/
33+
docs/source/modules.rst
34+
docs/source/optimism.*

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# OptimiSM: Computational solid mechanics made easy with Jax
22

33
![Continuous integration](https://github.com/sandialabs/optimism/actions/workflows/ci-build.yml/badge.svg)
4+
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://sandialabs.github.io/optimism/)
5+
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://sandialabs.github.io/optimism/dev/)
46
[![Coverage](https://codecov.io/gh/sandialabs/optimism/branch/main/graph/badge.svg)](https://codecov.io/gh/sandialabs/optimism)
57
## What is OptimiSM?
68

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/source/conf.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
import os
9+
import sys
10+
sys.path.insert(0, os.path.abspath('../../'))
11+
12+
13+
project = 'optimism'
14+
copyright = '2024, Brandon Talamini, Mike Tupek'
15+
author = 'Brandon Talamini, Mike Tupek'
16+
release = '0.1.0'
17+
18+
# -- General configuration ---------------------------------------------------
19+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
20+
21+
extensions = [
22+
'sphinx_copybutton',
23+
'sphinx.ext.autodoc',
24+
'sphinx.ext.autosummary',
25+
'sphinx.ext.coverage',
26+
'sphinx.ext.napoleon',
27+
'sphinx.ext.viewcode'
28+
]
29+
30+
templates_path = ['_templates']
31+
exclude_patterns = []
32+
html_theme = 'sphinx_rtd_theme'
33+
34+
# -- Options for HTML output -------------------------------------------------
35+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
36+
37+
html_static_path = ['_static']
38+
39+
# autodoc_default_options = {
40+
# 'members': True
41+
# }

docs/source/index.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.. optimism documentation master file, created by
2+
sphinx-quickstart on Fri Oct 18 12:13:55 2024.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
optimism documentation
7+
======================
8+
9+
Add your content using ``reStructuredText`` syntax. See the
10+
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
11+
documentation for details.
12+
13+
14+
.. toctree::
15+
:maxdepth: 2
16+
:caption: Contents:
17+
18+
modules
19+
optimism
20+
21+
Indices and Tables
22+
==================
23+
24+
* :ref:`genindex`
25+
* :ref:`modindex`
26+
* :ref:`search`

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
'metis'],
1313
#tests_require=[], # could put chex and pytest here
1414
extras_require={'sparse': ['scikit-sparse'],
15-
'test': ['pytest', 'pytest-cov', 'pytest-xdist']},
15+
'test': ['pytest', 'pytest-cov', 'pytest-xdist'],
16+
'docs': ['sphinx', 'sphinx-copybutton', 'sphinx-rtd-theme', 'sphinxcontrib-bibtex', 'sphinxcontrib-napoleon']},
1617
python_requires='>=3.7',
1718
version='0.0.1',
1819
license='MIT',

0 commit comments

Comments
 (0)