diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..808e8b4 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,17 @@ +version: 2 + +build: + os: "ubuntu-22.04" + tools: + python: "3.11" + jobs: + post_install: + - bash scripts/doc/build_doc_pre_work.sh + +python: + install: + - requirements: requirements/runtime.txt + - requirements: requirements/docs.txt + +sphinx: + configuration: docs/source/conf.py diff --git a/docs/source/conf.py b/docs/source/conf.py index 02d1fc6..79c4a65 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -21,11 +21,11 @@ # 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 sphinx_markdown_tables # NOQA -import sphinx_rtd_theme import codecs import os +import sphinx_rtd_theme + # -- Project information ----------------------------------------------------- project = "tzrec" diff --git a/scripts/build_docs.sh b/scripts/doc/build_doc_pre_work.sh similarity index 62% rename from scripts/build_docs.sh rename to scripts/doc/build_doc_pre_work.sh index b87fdb0..0bc3aaf 100644 --- a/scripts/build_docs.sh +++ b/scripts/doc/build_doc_pre_work.sh @@ -1,14 +1,9 @@ -# Make sure in python3 environment -DATE=`date +'%Y%m%d'` +#!/usr/bin/env bash # make proto bash scripts/gen_proto.sh sed -i 's#
#
#g;s###g' docs/source/proto.html -# install requirements -python setup.py install -pip install -r requirements/docs.txt - # copy intro sed 's#(docs/source/#(#g;s#(docs/images/#(../images/#g' README.md > docs/source/intro.md @@ -19,19 +14,3 @@ for f in docs/source/quick_start/*.md; do cp $f $f.bak sed -i 's/${TZREC_NIGHTLY_VERSION}/'"${LATEST_WHEEL_VERSION}"'/g;s/${TZREC_DOCKER_VERSION}/'"${LATEST_DOCKER_VERSION}"'/g' $f done - -# make sphinx -cd docs -rm -rf build -make html -rm -rf build/html/_modules -cd - - -# revert wheel and docker version -for f in docs/source/quick_start/*.md; do - mv $f.bak $f -done - -# python post_fix.py build/html/search.html - -echo "view docs: python -m http.server --directory=docs/build/html/ 8081" diff --git a/scripts/doc/build_docs.sh b/scripts/doc/build_docs.sh new file mode 100644 index 0000000..af27520 --- /dev/null +++ b/scripts/doc/build_docs.sh @@ -0,0 +1,25 @@ +# Make sure in python3 environment +DATE=`date +'%Y%m%d'` + +# install requirements +python setup.py install +pip install -r requirements/docs.txt + +# edit docs, e.g., replace version info +bash scripts/doc/build_doc_pre_work.sh + +# make sphinx +cd docs +rm -rf build +make html +rm -rf build/html/_modules +cd - + +# revert wheel and docker version +for f in docs/source/quick_start/*.md; do + mv $f.bak $f +done + +# python post_fix.py build/html/search.html + +echo "view docs: python -m http.server --directory=docs/build/html/ 8081"