Skip to content

Commit

Permalink
Merge pull request #173 from aragilar/fix-api-docs
Browse files Browse the repository at this point in the history
Try to get the both online sphinx docs working
  • Loading branch information
aragilar authored Jul 11, 2024
2 parents 598032c + c654eab commit 2279627
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-overall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
sundials-index-size: 64
- python-version: "3.11"
sundials-version: "6.5.0"
tox-env: doctr
tox-env: apidocs-deploy
sundials-precision: double
sundials-index-size: 64
- python-version: "3.11"
Expand Down
6 changes: 1 addition & 5 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
os: ubuntu-lts-latest
tools:
python: "3.11"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
Expand Down
4 changes: 2 additions & 2 deletions apidocs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ scikits.odes
scikits.odes.ode
----------------
.. automodule:: scikits.odes.ode
:members: OdeBase
:members:

scikits.odes.dae
----------------
.. automodule:: scikits.odes.dae
:members: DaeBase
:members:

scikits.odes.dopri5
--------------------
Expand Down
4 changes: 3 additions & 1 deletion apidocs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.intersphinx',
'docs_versions_menu',
'sphinxcontrib.jquery',
]

intersphinx_mapping = {
'scipy': (
'https://docs.scipy.org/doc/scipy/reference/', None
'https://docs.scipy.org/doc/scipy/', None
)
}

Expand Down
2 changes: 2 additions & 0 deletions apidocs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
sphinx>=1.4
sphinx_rtd_theme
sphinxcontrib-jquery
docs-versions-menu
19 changes: 19 additions & 0 deletions apidocs/upload_api_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

set -ex

# Clone gh-pages
git clone --branch gh-pages https://github.com/bmcage/odes gh-pages
# Run rsync
branch_name="$GITHUB_REF_NAME"
rsync -av --delete "$API_DOCS_OUT_DIR" "./gh-pages/$branch_name/"
# Run docs-versions-menu
cd gh-pages
docs-versions-menu
# Commit and push
git config user.name github-actions
git config user.email github-actions@github.com
git add -A --verbose
git status
git commit --verbose -m "Auto-update from Github Actions Workflow" -m "Deployed from commit ${GITHUB_SHA} (${GITHUB_REF})"
git push --verbose --force "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/bmcage" gh-pages
22 changes: 14 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import subprocess

try:
sk_version = subprocess.run(
["git", "describe", "--tags", "--dirty", "--always"],
capture_output=True,
check=True,
text=True,
).stdout.strip()
except:
sk_version = os.environ["SCIKITS_ODES_VERSION"]

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
import scikits.odes

# -- General configuration ------------------------------------------------

Expand All @@ -39,7 +45,7 @@

intersphinx_mapping = {
'scipy': (
'https://docs.scipy.org/doc/scipy/reference/', None
'https://docs.scipy.org/doc/scipy/', None
),
'apidocs': (
'https://bmcage.github.io/odes/dev', None
Expand Down Expand Up @@ -67,9 +73,9 @@
# built documents.
#
# The short X.Y version.
version = scikits.odes.__version__
version = sk_version
# The full version, including alpha/beta/rc tags.
release = scikits.odes.__version__
release = sk_version

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion packages/scikits-odes/src/scikits/odes/ode.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Compat with older versions
from scikits_odes.odes import *
from scikits_odes.ode import *
6 changes: 2 additions & 4 deletions packages/scikits-odes/src/scikits_odes/dae.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ class dae(object):
x : independent variable, eg the time, float
y : array of n unknowns in x
yprime : dy/dx array of n unknowns in x, dimension = dim(y)
return_residual: array that must be updated with the value of the
residuals, so G(t,y,y'). The dimension is equal to dim(y)
return value: integer, 0 for success. It is not guaranteed that a solver
takes this status into account
return_residual: array that must be updated with the value of the residuals, so G(t,y,y'). The dimension is equal to dim(y)
return value: integer, 0 for success. It is not guaranteed that a solver takes this status into account
Some solvers will allow userdata to be passed to eqsres, or optional
formats that are more performant.
Expand Down
19 changes: 7 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,28 @@ deps =
notebooks: nbval
notebooks: -r notebook-requirements.txt
commands =
env
env | sort
test: pytest --pyargs scikits.odes --pyargs scikits_odes --pyargs scikits_odes_core --pyargs scikits_odes_daepack --pyargs scikits_odes_sundials {posargs}
notebooks: pytest --nbval ipython_examples/

[testenv:doctr]
[testenv:apidocs]
passenv=*
setenv=
API_DOCS_OUT_DIR={envtmpdir}/html
deps=
packages/scikits-odes
packages/scikits-odes-core
packages/scikits-odes-daepack
packages/scikits-odes-sundials
doctr
jinja2
-rapidocs/requirements.txt
commands=
env
./upload_api_docs.sh
changedir =
{toxinidir}
sphinx-build -W -b html -d {envtmpdir}/doctrees . {env:API_DOCS_OUT_DIR}
upload: ./upload_api_docs.sh
changedir=apidocs

[testenv:docs]
changedir=docs
deps=
packages/scikits-odes
packages/scikits-odes-core
packages/scikits-odes-daepack
packages/scikits-odes-sundials
-rdocs/requirements.txt
commands=
sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
24 changes: 0 additions & 24 deletions upload_api_docs.sh

This file was deleted.

0 comments on commit 2279627

Please sign in to comment.