Skip to content

Commit c4165cb

Browse files
author
William Grant
committed
Add ReadTheDocs config to docs
Config code will regenerate the docs from the docstrings every rebuild. Also excludes tests from the generated html. Docs will be available at typed-python.readthedocs.io.
1 parent 11e5e28 commit c4165cb

File tree

3 files changed

+39
-19
lines changed

3 files changed

+39
-19
lines changed

.readthedocs.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
3+
build:
4+
os: "ubuntu-20.04"
5+
tools:
6+
python: "3.10"
7+
jobs:
8+
pre_build:
9+
- sphinx-apidoc -fo docs/api typed_python typed_python/*test* typed_python/*/*test*
10+
11+
12+
python:
13+
install:
14+
- requirements: docs/doc_requirements.txt

docs/Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
# Minimal makefile for Sphinx documentation
2-
3-
2+
SHELL = /bin/bash
3+
# SHELL = /bin/zsh
4+
.SHELLFLAGS = -O globstar -c # enable globstar operator
45

56
# You can set these variables from the command line, and also
67
# from the environment for the first two.
78
SPHINXOPTS ?=
89
SPHINXBUILD ?= sphinx-build
910
SOURCEDIR = .
1011
BUILDDIR = _build
11-
APIBUILDDIR = api
12+
APIBUILDDIR = api
1213
MODULEDIR = ../typed_python
13-
1414
# Put it first so that "make" without argument is like "make help".
1515
help:
1616
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1717

1818
.PHONY: help clean apidocs Makefile
1919

2020
apidocs:
21-
@sphinx-apidoc -fo "$(APIBUILDDIR)" "$(MODULEDIR)"
21+
@sphinx-apidoc -fo "$(APIBUILDDIR)" "$(MODULEDIR)" $(MODULEDIR)/**/*test*
2222

2323
clean:
2424
-rm -rf "$(BUILDDIR)"/*

docs/conf.py

+20-14
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,33 @@
88
import os
99
import sys
1010

11-
project = 'typed_python'
12-
copyright = '2022, Braxton McKee'
13-
author = 'Braxton McKee'
14-
release = '0.2.6'
11+
project = "typed_python"
12+
copyright = "2022, Braxton McKee"
13+
author = "Braxton McKee"
14+
release = "0.2.6"
1515

1616
# -- General configuration ---------------------------------------------------
1717
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1818

19-
extensions = ['myst_parser',
20-
'sphinx.ext.autodoc',
21-
'sphinx.ext.napoleon',
22-
'sphinx.ext.viewcode'
23-
]
19+
extensions = [
20+
"myst_parser",
21+
"sphinx.ext.autodoc",
22+
"sphinx.ext.napoleon",
23+
"sphinx.ext.viewcode",
24+
]
2425

25-
templates_path = ['_templates']
26-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
26+
source_suffix = {
27+
".rst": "restructuredtext",
28+
".md": "markdown",
29+
}
30+
31+
templates_path = ["_templates"]
32+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
2733

2834
# -- Options for HTML output -------------------------------------------------
2935
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
3036

31-
html_theme = 'sphinx_book_theme'
32-
html_static_path = ['_static']
37+
html_theme = "sphinx_book_theme"
38+
html_static_path = ["_static"]
3339

34-
sys.path.insert(0, os.path.abspath('..'))
40+
sys.path.insert(0, os.path.abspath(".."))

0 commit comments

Comments
 (0)