Skip to content

Commit

Permalink
[doc] add readthedocs yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
tiankongdeguiji committed Sep 25, 2024
1 parent 8069107 commit e478c22
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 24 deletions.
17 changes: 17 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
23 changes: 1 addition & 22 deletions scripts/build_docs.sh → scripts/doc/build_doc_pre_work.sh
Original file line number Diff line number Diff line change
@@ -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#<p>#<pre>#g;s#</p>#</pre>#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

Expand All @@ -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"
25 changes: 25 additions & 0 deletions scripts/doc/build_docs.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit e478c22

Please sign in to comment.