Skip to content

Commit 46cd323

Browse files
authored
Enable ReadTheDocs on v3 (#4805)
* Add readthedocs yml file * Manually invoke building gallery instead of using it as an extension * Bring back the gallery extension. Just create the required directories for sphinx to build tutorials and examples section * Fixup a bug when expected static directories are already present; Simplified to use existing directories path * Simplified relative urls handling * Given a mention in release notes * Add installation links to landing page * Update pymc-examples submodule * Fix relative links for in-depth guides
1 parent bf83ae6 commit 46cd323

File tree

6 files changed

+54
-25
lines changed

6 files changed

+54
-25
lines changed

.readthedocs.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
3+
sphinx:
4+
configuration: docs/source/conf.py
5+
6+
python:
7+
version: 3.7
8+
install:
9+
- requirements: requirements-dev.txt
10+
- method: pip
11+
path: .
12+
13+
14+
submodules:
15+
include: all
16+
recursive: true

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
+ `theano.printing.pydotprint` is now hotfixed upon import (see [#4594](https://github.com/pymc-devs/pymc3/pull/4594)).
77
+ Fix bug in the computation of the log pseudolikelihood values (SMC-ABC). (see [#4672](https://github.com/pymc-devs/pymc3/pull/4672)).
88
+ Fix `LKJCorr.random` method to work with `pm.sample_prior_predictive`. (see [#4780](https://github.com/pymc-devs/pymc3/pull/4780))
9+
+ Enable documentation generation via ReadTheDocs for upcoming v3 releases. (see [#4805](https://github.com/pymc-devs/pymc3/pull/4805)).
910

1011
### New Features
1112
+ Generalized BART, bounded distributions like Binomial and Poisson can now be used as likelihoods (see [#4675](https://github.com/pymc-devs/pymc3/pull/4675), [#4709](https://github.com/pymc-devs/pymc3/pull/4709) and

docs/source/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import os
1616
import sys
1717

18+
from pathlib import Path
19+
1820
import pymc3
1921

2022
# If extensions (or modules to document with autodoc) are in another directory,
@@ -330,3 +332,6 @@
330332
def setup(app):
331333
app.add_css_file("https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.css")
332334
app.add_css_file("default.css")
335+
dir_root = Path(__file__).parent
336+
for directory in html_static_path:
337+
os.makedirs(str(dir_root / directory), exist_ok=True)

docs/source/index.rst

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,60 +44,60 @@
4444

4545
<div class="ui container">
4646

47-
<h2 class="ui dividing header">Installation</h2>
48-
49-
<div class="row">
50-
<div class="ui text container">
51-
<h3 class="ui header">Via conda-forge:</h3>
52-
53-
.. code-block:: bash
54-
55-
conda install -c conda-forge pymc3
56-
57-
58-
.. raw:: html
59-
60-
<h3 class="ui header">Latest (unstable):</h3>
47+
<div class="ui vertical segment">
48+
<h2 class="ui dividing header">Installation</h2>
49+
<div class="ui three stackable cards">
6150

62-
.. code-block:: bash
51+
<a class="ui link card" href="https://github.com/pymc-devs/pymc3/wiki/Installation-Guide-(Linux)">
52+
<div class="content">
53+
<div class="header">Instructions for Linux</div>
54+
</div>
55+
</a>
6356

64-
pip install git+https://github.com/pymc-devs/pymc3
57+
<a class="ui link card" href="https://github.com/pymc-devs/pymc3/wiki/Installation-Guide-(MacOS)">
58+
<div class="content">
59+
<div class="header">Instructions for MacOS</div>
60+
</div>
61+
</a>
6562

66-
.. raw:: html
63+
<a class="ui link card" href="https://github.com/pymc-devs/pymc3/wiki/Installation-Guide-(Windows)">
64+
<div class="content">
65+
<div class="header">Instructions for Windows</div>
66+
</div>
67+
</a>
6768

68-
</div>
6969
</div>
7070
</div>
7171

7272
<div class="ui vertical segment">
7373
<h2 class="ui dividing header">In-Depth Guides</h2>
7474
<div class="ui four stackable cards">
7575

76-
<a class="ui link card" href="/Probability_Distributions.html">
76+
<a class="ui link card" href="Probability_Distributions.html">
7777
<div class="content">
7878
<div class="header">Probability Distributions</div>
7979
<div class="description">PyMC3 includes a comprehensive set of pre-defined statistical distributions that can be used as model building blocks.
8080
</div>
8181
</div>
8282
</a>
8383

84-
<a class="ui link card" href="/Gaussian_Processes.html">
84+
<a class="ui link card" href="Gaussian_Processes.html">
8585
<div class="content">
8686
<div class="header">Gaussian Processes</div>
8787
<div class="description">Sometimes an unknown parameter or variable in a model is not a scalar value or a fixed-length vector, but a function. A Gaussian process (GP) can be used as a prior probability distribution whose support is over the space of continuous functions. PyMC3 provides rich support for defining and using GPs.
8888
</div>
8989
</div>
9090
</a>
9191

92-
<a class="ui link card" href="/pymc-examples/examples/variational_inference/variational_api_quickstart.html">
92+
<a class="ui link card" href="pymc-examples/examples/variational_inference/variational_api_quickstart.html">
9393
<div class="content">
9494
<div class="header">Variational Inference</div>
9595
<div class="description">Variational inference saves computational cost by turning a problem of integration into one of optimization. PyMC3's variational API supports a number of cutting edge algorithms, as well as minibatch for scaling to large datasets.
9696
</div>
9797
</div>
9898
</a>
9999

100-
<a class="ui link card" href="/PyMC3_and_Theano.html">
100+
<a class="ui link card" href="PyMC3_and_Theano.html">
101101
<div class="content">
102102
<div class="header">PyMC3 and Theano</div>
103103
<div class="description">Theano is the deep-learning library PyMC3 uses to construct probability distributions and then access the gradient in order to implement cutting edge inference algorithms. More advanced models may be built by understanding this layer.

docs/source/pymc-examples

Submodule pymc-examples updated 95 files

docs/source/sphinxext/gallery_generator.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,23 @@ def build_gallery(srcdir, gallery):
170170
if basename.find(".rst") < 1:
171171
filename = os.path.join(source_dir, basename + ".ipynb")
172172
ex = NotebookGenerator(filename, target_dir)
173+
url = Path(os.path.join(os.sep, gallery, ex.output_html))
174+
# Need to chop off "/${gallery}/../" so as redirection works in multi versioned docs.
175+
url = str(Path("..", *url.parts[3:]))
173176
data[basename] = {
174177
"title": ex.pagetitle,
175-
"url": os.path.join(os.sep, gallery, ex.output_html),
178+
"url": url,
176179
"thumb": os.path.basename(ex.png_path),
177180
}
181+
178182
else:
179183
filename = basename.split(".")[0]
184+
url = Path(os.path.join(os.sep, gallery, "../" + filename + ".html"))
185+
# Need to chop off "/${gallery}/../" so as redirection works in multi versioned docs.
186+
url = str(Path("..", *url.parts[3:]))
180187
data[basename] = {
181188
"title": " ".join(filename.split("_")),
182-
"url": os.path.join(os.sep, gallery, "../" + filename + ".html"),
189+
"url": url,
183190
"thumb": os.path.basename(default_png_path),
184191
}
185192

0 commit comments

Comments
 (0)