Skip to content

Commit 0139223

Browse files
authored
Initialize standalone build (#218)
* Initialize standalone build * couple minor fixes to trigger readthedocs * extend contributing docs * review suggesions
1 parent 014bc47 commit 0139223

14 files changed

+688
-430
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
*.pyc
22
.ipynb_checkpoints
33
.vscode/*
4+
5+
_build
6+
jupyter_execute

.readthedocs.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
3+
sphinx:
4+
configuration: examples/conf.py
5+
6+
python:
7+
version: "3.8"
8+
install:
9+
- requirements: requirements-docs.txt
10+
- method: pip
11+
path: .

CONTRIBUTING.md

+15
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,18 @@ We recommended that your contribution complies with the following guidelines bef
106106
* No `pre-commit` errors: see the [Jupyter Notebook style](https://github.com/pymc-devs/pymc3/wiki/PyMC3-Jupyter-Notebook-Style-Guide) (and [Python code style](https://github.com/pymc-devs/pymc3/wiki/PyMC3-Python-Code-Style)) page from our Wiki on how to install and run it.
107107

108108
* Indicate how are you aiming to update the notebook (i.e. what is the target end column in the tracker). The pull request template has a template for this.
109+
110+
## Contributor guide
111+
In order to work and run the example notebooks you need to install the packages in
112+
`requirements-write.txt`. To see how the notebook looks rendered, you can follow
113+
the instructions in the following paragraph or open a PR to see the preview in
114+
readthedocs.
115+
116+
The markdown cells in the notebook can use MyST, a superset of CommonMark markdown. See
117+
https://myst-parser.readthedocs.io/en/latest/ and https://myst-nb.readthedocs.io/en/latest/
118+
for documentation on their features and syntax.
119+
120+
To generate the draft standalone notebook gallery, you need to have installed all the packages in
121+
`requirements-docs.txt` and to run `sphinx-build examples/ _build -b html` from the repository
122+
home directory. After building, you can see the preview of the docs
123+
by opening `_build/index.html` file with your browser.

_static/PyMC3.ico

4.19 KB
Binary file not shown.

examples/bibliography.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# General Bibliography
2+
3+
:::{bibliography}
4+
:all:
5+
6+
:::

examples/blog.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Blog
2+
3+
<!-- auto generated by ablog so it's empty -->

examples/case_studies/multilevel_modeling.ipynb

+21-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# A Primer on Bayesian Methods for Multilevel Modeling"
7+
"# A Primer on Bayesian Methods for Multilevel Modeling\n",
8+
"\n",
9+
":::{post} 30 Aug, 2021\n",
10+
":tags: hierarchical\n",
11+
":category: intermediate\n",
12+
":::"
813
]
914
},
1015
{
@@ -20,7 +25,7 @@
2025
"cell_type": "markdown",
2126
"metadata": {},
2227
"source": [
23-
"## Example: Radon contamination (Gelman and Hill 2006)\n",
28+
"## Example: Radon contamination {cite:t}`gelman2006data`\n",
2429
"\n",
2530
"Radon is a radioactive gas that enters homes through contact points with the ground. It is a carcinogen that is the primary cause of lung cancer in non-smokers. Radon levels vary greatly from household to household.\n",
2631
"\n",
@@ -8498,11 +8503,19 @@
84988503
"\n",
84998504
"## References\n",
85008505
"\n",
8501-
"- Gelman, A., & Hill, J. (2006), *Data Analysis Using Regression and Multilevel/Hierarchical Models (1st ed.)*, Cambridge University Press.\n",
8502-
"\n",
8503-
"- Gelman, A. (2006), *Multilevel (Hierarchical) modeling: what it can and cannot do*, Technometrics, 48(3), 432–435.\n",
8506+
":::{bibliography}\n",
8507+
":filter: docname in docnames\n",
85048508
"\n",
8505-
"- McElreath, R. (2020), *Statistical Rethinking - A Bayesian Course with Examples in R and Stan (2nd ed.)*, CRC Press. "
8509+
"gelman2006multilevel\n",
8510+
"mcelreath2018statistical\n",
8511+
":::"
8512+
]
8513+
},
8514+
{
8515+
"cell_type": "markdown",
8516+
"metadata": {},
8517+
"source": [
8518+
"## Watermark"
85068519
]
85078520
},
85088521
{
@@ -8543,7 +8556,7 @@
85438556
"metadata": {
85448557
"celltoolbar": "Raw Cell Format",
85458558
"kernelspec": {
8546-
"display_name": "Python 3",
8559+
"display_name": "Python 3 (ipykernel)",
85478560
"language": "python",
85488561
"name": "python3"
85498562
},
@@ -8557,7 +8570,7 @@
85578570
"name": "python",
85588571
"nbconvert_exporter": "python",
85598572
"pygments_lexer": "ipython3",
8560-
"version": "3.6.9"
8573+
"version": "3.8.6"
85618574
}
85628575
},
85638576
"nbformat": 4,

examples/case_studies/rugby_analytics.ipynb

+8-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# A Hierarchical model for Rugby prediction"
7+
"# A Hierarchical model for Rugby prediction\n",
8+
"\n",
9+
":::{post} 30 Aug, 2021\n",
10+
":tags: hierarchical, sports\n",
11+
":category: intermediate\n",
12+
":::"
813
]
914
},
1015
{
@@ -2424,7 +2429,7 @@
24242429
"metadata": {
24252430
"anaconda-cloud": {},
24262431
"kernelspec": {
2427-
"display_name": "Python 3",
2432+
"display_name": "Python 3 (ipykernel)",
24282433
"language": "python",
24292434
"name": "python3"
24302435
},
@@ -2438,7 +2443,7 @@
24382443
"name": "python",
24392444
"nbconvert_exporter": "python",
24402445
"pygments_lexer": "ipython3",
2441-
"version": "3.9.2"
2446+
"version": "3.8.6"
24422447
}
24432448
},
24442449
"nbformat": 4,

examples/conf.py

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
# import os
14+
# import sys
15+
# sys.path.insert(0, os.path.abspath('.'))
16+
17+
18+
# -- Project information -----------------------------------------------------
19+
20+
project = "PyMC3"
21+
copyright = "2021, PyMC Community"
22+
author = "PyMC Community"
23+
24+
25+
# -- General configuration ---------------------------------------------------
26+
27+
# Add any Sphinx extension module names here, as strings. They can be
28+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
29+
# ones.
30+
extensions = [
31+
"sphinx.ext.intersphinx",
32+
"sphinx.ext.mathjax",
33+
"myst_nb",
34+
"ablog",
35+
"sphinx_design",
36+
"sphinxext.opengraph",
37+
"sphinx_copybutton",
38+
"sphinxcontrib.bibtex",
39+
]
40+
41+
# List of patterns, relative to source directory, that match files and
42+
# directories to ignore when looking for source files.
43+
# This pattern also affects html_static_path and html_extra_path.
44+
exclude_patterns = [
45+
"_build",
46+
"Thumbs.db",
47+
".DS_Store",
48+
"*import_posts*",
49+
"**/.ipynb_checkpoints/*",
50+
]
51+
52+
53+
# -- Options for HTML output -------------------------------------------------
54+
55+
# The theme to use for HTML and HTML Help pages. See the documentation for
56+
# a list of builtin themes.
57+
58+
# theme options
59+
html_theme = "pydata_sphinx_theme"
60+
html_theme_options = {
61+
"icon_links": [
62+
{
63+
"name": "GitHub",
64+
"url": "https://github.com/pymc-devs/pymc-examples",
65+
"icon": "fab fa-github-square",
66+
},
67+
{
68+
"name": "Twitter",
69+
"url": "https://twitter.com/pymc-devs",
70+
"icon": "fab fa-twitter-square",
71+
},
72+
{
73+
"name": "Discourse",
74+
"url": "https://discourse.pymc.io",
75+
"icon": "fab fa-discourse",
76+
},
77+
],
78+
"search_bar_text": "Search...",
79+
"navbar_end": ["search-field.html", "navbar-icon-links.html"],
80+
"external_links": [
81+
{"name": "Learning", "url": "https://pymc3.readthedocs.io/en/latest/learn.html"},
82+
{"name": "API", "url": "https://pymc3.readthedocs.io/en/latest/api.html"}
83+
]
84+
}
85+
86+
html_favicon = "../_static/PyMC3.ico"
87+
88+
# Add any paths that contain custom static files (such as style sheets) here,
89+
# relative to this directory. They are copied after the builtin static files,
90+
# so a file named "default.css" will overwrite the builtin "default.css".
91+
html_static_path = ["../_static"]
92+
html_sidebars = {
93+
"**": ["sidebar-nav-bs.html", "tagcloud.html", "categories.html"],
94+
}
95+
96+
# ablog config
97+
# blog_baseurl = "https://predictablynoisy.com"
98+
blog_title = "PyMC Examples"
99+
blog_path = "blog"
100+
# fontawesome_included = True
101+
# post_redirect_refresh = 1
102+
# post_auto_image = 1
103+
# post_auto_excerpt = 2
104+
105+
# MyST config
106+
myst_enable_extensions = [
107+
"colon_fence",
108+
"deflist",
109+
"dollarmath",
110+
"amsmath"
111+
]
112+
113+
# bibtex config
114+
bibtex_bibfiles = ['references.bib']
115+
bibtex_default_style = 'unsrt'
116+
bibtex_reference_style = "author_year"
117+
118+
# OpenGraph config
119+
# ogp_site_url = "https://predictablynoisy.com"
120+
# ogp_image = "https://predictablynoisy.com/_static/profile-bw.png"
121+
122+
# Temporarily stored as off until we fix it
123+
jupyter_execute_notebooks = "off"
124+
125+
# intersphinx mappings
126+
intersphinx_mapping = {
127+
"aesara": ("https://aesara.readthedocs.io/en/latest/", None),
128+
"arviz": ("https://arviz-devs.github.io/arviz/", None),
129+
# "mpl": ("https://matplotlib.org/", None),
130+
# "numpy": ("https://numpy.org/doc/stable/", None),
131+
# "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
132+
"pymc3": ("https://docs.pymc.io/", None),
133+
# "scipy": ("https://docs.scipy.org/doc/scipy/reference/", None),
134+
# "xarray": ("http://xarray.pydata.org/en/stable/", None),
135+
}

0 commit comments

Comments
 (0)