-
Notifications
You must be signed in to change notification settings - Fork 1
/
.readthedocs.yaml
41 lines (36 loc) · 2.02 KB
/
.readthedocs.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "3.10"
jobs:
post_checkout:
# egrep '^(sphinx|sphinx-rtd-theme|myst-parser|click) = ' pyproject.toml | sed -E 's/ = (\{version = )?"[^0-9]?([0-9].*)"(, .*|$)/==\2/' > docs/requirements.txt
- echo "The command below creates requirements.txt"; grep "sphinx|sphinx-rtd-theme" .readthedocs.yaml | head -1 | sed "s/^ *# //"
- grep "sphinx|sphinx-rtd-theme" .readthedocs.yaml | head -1 | sed "s/^ *# //" | bash
pre_build:
# /home/docs/checkouts/readthedocs.org/user_builds/fagus/envs/latest/bin/python -c 'from package import sphinx_hacks; import json; json.dump(sphinx_hacks("general"), open("orig_files.json", "w"))'
- sphinx-apidoc -f --module-first --separate -o docs/source . tests package.py
- echo "The command below applies general sphinx-hacks"; grep sphinx_hacks .readthedocs.yaml | grep general | head -1 | sed "s/^ *# //";
- grep sphinx_hacks .readthedocs.yaml | grep general | head -1 | sed "s/^ *# //" | bash
post_build:
# /home/docs/checkouts/readthedocs.org/user_builds/fagus/envs/latest/bin/python -c 'from package import sphinx_hacks; import json; sphinx_hacks(restore=json.load(open("orig_files.json")))'
- echo "The command below restores applied sphinx-hacks"; grep sphinx_hacks .readthedocs.yaml | grep restore | head -1 | sed "s/^ *# //"
- grep sphinx_hacks .readthedocs.yaml | grep restore | head -1 | sed "s/^ *# //" | bash
- rm orig_files.json docs/requirements.txt
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
# If using Sphinx, optionally _build your docs in additional formats such as PDF
formats:
- pdf
- epub
# Optionally declare the Python requirements required to _build your docs
python:
install:
- requirements: docs/requirements.txt