Skip to content

Commit

Permalink
Add sphinx docs creation to Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
ZigaMr committed Dec 4, 2024
1 parent 8fb8e5b commit 35e5862
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
15 changes: 1 addition & 14 deletions .github/workflows/ci-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,20 +164,7 @@ jobs:
- name: Build docs
run: |
mkdir docs
cd docs
sphinx-quickstart --quiet --sep --project=sapphirepy --copyright="2024, Oasis Protocol Foundation" --author="[email protected]" --ext-autodoc --ext-viewcode
pip install furo
sed -i "s/^html_theme = 'alabaster'/html_theme = 'furo'/" source/conf.py
# Modify conf.py programmatically
sed -i "s/^extensions = \[/extensions = [\n 'myst_parser',/" source/conf.py
echo "source_suffix = {'.rst': 'restructuredtext', '.md': 'markdown'}" >> source/conf.py
sed -i '/^Add your content/,/details\.$/d; /^sapphirepy documentation$/,/^=\+$/c\sapphirepy documentation\n========================\n\n.. automodule:: sapphirepy\n :members:\n :undoc-members:\n :show-inheritance:\n\n.. include:: ../../README.md\n :parser: markdown\n' source/index.rst
echo -e "\n modules" >> source/index.rst
cd .. # Back to project root
sphinx-apidoc -o docs/source/ $(pip show sapphire-py | grep Location | cut -d' ' -f2)/sapphirepy
make docs
cd docs
make html
Expand Down
12 changes: 12 additions & 0 deletions clients/py/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,15 @@ build: wheel

wheel:
$(PYTHON) setup.py bdist_wheel

docs:
mkdir docs
cd docs && sphinx-quickstart --quiet --sep --project=sapphirepy --author='[email protected]' --ext-autodoc --ext-viewcode
sed -i "s/^copyright = .*/copyright = '2024, Oasis Protocol Foundation'/" docs/source/conf.py
pip install furo
sed -i "s/^html_theme = 'alabaster'/html_theme = 'furo'/" docs/source/conf.py
sed -i "s/^extensions = \[/extensions = [\n 'myst_parser',/" docs/source/conf.py
echo "source_suffix = {'.rst': 'restructuredtext', '.md': 'markdown'}" >> docs/source/conf.py
sed -i '/Add your content/,/details/c\\n.. automodule:: sapphirepy\n :members:\n :undoc-members:\n :show-inheritance:\n\n.. include:: ../../README.md\n :parser: markdown' docs/source/index.rst
echo "\n modules" >> docs/source/index.rst
sphinx-apidoc -o docs/source/ $$(pip show sapphire-py | grep Location | cut -d' ' -f2)/sapphirepy

0 comments on commit 35e5862

Please sign in to comment.