Skip to content

Commit 7434b8f

Browse files
committed
fixup so docs work with latest pymc-examples reorg
1 parent 9a3d6e8 commit 7434b8f

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
</div>
9797
</a>
9898

99-
<a class="ui link card" href="/pymc-examples/notebooks/variational_api_quickstart.html">
99+
<a class="ui link card" href="/pymc-examples/examples/variational_inference/variational_api_quickstart.html">
100100
<div class="content">
101101
<div class="header">Variational Inference</div>
102102
<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.

docs/source/pymc-examples

Submodule pymc-examples updated 129 files

docs/source/semantic_sphinx/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<div class="ui center aligned text container">
7777
<img src="https://cdn.rawgit.com/pymc-devs/pymc3/master/docs/logos/svg/PyMC3_banner.svg" />
7878
<h2>Probabilistic Programming in Python</h2>
79-
<a href="pymc-examples/notebooks/api_quickstart.html">
79+
<a href="pymc-examples/examples/pymc3_howto/api_quickstart.html">
8080
<div class="ui huge primary button">Quickstart <i class="right arrow icon"></i></div>
8181
</a>
8282
</div>

docs/source/sphinxext/gallery_generator.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
Modified from the seaborn project, which modified the mpld3 project.
55
"""
66
import base64
7-
import glob
87
import json
98
import os
109
import runpy
1110
import shutil
1211

12+
from pathlib import Path
13+
1314
import matplotlib
1415

1516
matplotlib.use("Agg")
@@ -72,8 +73,8 @@ class NotebookGenerator:
7273
def __init__(self, filename, target_dir):
7374
self.basename = os.path.basename(filename)
7475
self.stripped_name = os.path.splitext(self.basename)[0]
75-
self.output_html = os.path.join(
76-
"..", "pymc-examples", "notebooks", f"{self.stripped_name}.html"
76+
self.output_html = str(
77+
Path("..") / Path(filename).relative_to(Path.cwd()).with_suffix(".html")
7778
)
7879
self.image_dir = os.path.join(target_dir, "_images")
7980
self.png_path = os.path.join(self.image_dir, f"{self.stripped_name}.png")
@@ -141,7 +142,7 @@ def build_gallery(srcdir, gallery):
141142
image_dir = os.path.join(target_dir, "_images")
142143
source_dir = os.path.abspath(
143144
os.path.join(
144-
os.path.dirname(os.path.dirname(srcdir)), "docs", "source", "pymc-examples", "notebooks"
145+
os.path.dirname(os.path.dirname(srcdir)), "docs", "source", "pymc-examples", "examples"
145146
)
146147
)
147148
table_of_contents_file = os.path.join(source_dir, TABLE_OF_CONTENTS_FILENAME.format(gallery))
@@ -171,7 +172,7 @@ def build_gallery(srcdir, gallery):
171172
if basename.find(".rst") < 1:
172173
filename = os.path.join(source_dir, basename + ".ipynb")
173174
ex = NotebookGenerator(filename, target_dir)
174-
data[ex.stripped_name] = {
175+
data[basename] = {
175176
"title": ex.pagetitle,
176177
"url": os.path.join(os.sep, gallery, ex.output_html),
177178
"thumb": os.path.basename(ex.png_path),
@@ -187,7 +188,6 @@ def build_gallery(srcdir, gallery):
187188
js_file = os.path.join(image_dir, f"gallery_{gallery}_contents.js")
188189
with open(table_of_contents_file) as toc:
189190
table_of_contents = toc.read()
190-
191191
js_contents = "Gallery.examples = {}\n{}".format(json.dumps(data), table_of_contents)
192192

193193
with open(js_file, "w") as js:

0 commit comments

Comments
 (0)