Skip to content

Commit f4343ca

Browse files
authored
Switch to pydata sphinx theme (#4761)
* start changing theme * customize theme to match our needs * remove extra custom css from build * add github and twitter icons * move search bar to navbar * add version number * remove sidebars from home page left to do: * fix gallery generator -> stop using javascript * fix home page * move away from so much custom html -> myst markdown? * improve homepage layout * start using sphinx panels * convert learn page from html to myst
1 parent 6eaf9a0 commit f4343ca

File tree

11 files changed

+268
-284
lines changed

11 files changed

+268
-284
lines changed

conda-envs/environment-dev-py37.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ dependencies:
1717
- numpydoc>=0.9
1818
- pandas=0.24
1919
- pre-commit>=2.8.0
20+
- pydata-sphinx-theme
2021
- pytest-cov>=2.5
2122
- pytest>=3.0
2223
- python-graphviz
2324
- python=3.7
2425
- recommonmark>=0.4
2526
- scipy>1.4.1
2627
- sphinx-autobuild>=0.7
28+
- sphinx-panels
2729
- sphinx>=1.5
2830
- typing-extensions
2931
- watermark

conda-envs/environment-dev-py38.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ dependencies:
1818
- numpydoc>=0.9
1919
- pandas
2020
- pre-commit>=2.8.0
21+
- pydata-sphinx-theme
2122
- pytest-cov>=2.5
2223
- pytest>=3.0
2324
- python-graphviz
2425
- python=3.8
2526
- recommonmark>=0.4
2627
- scipy>1.4.1
2728
- sphinx-autobuild>=0.7
29+
- sphinx-panels
2830
- sphinx>=1.5
2931
- typing-extensions>=3.7.4
3032
- watermark

conda-envs/environment-dev-py39.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ dependencies:
1818
- numpydoc>=0.9
1919
- pandas>=0.24.0
2020
- pre-commit>=2.8.0
21+
- pydata-sphinx-theme
2122
- pytest-cov>=2.5
2223
- pytest>=3.0
2324
- python-graphviz
2425
- python=3.9
2526
- recommonmark>=0.4
2627
- scipy>1.4.1
2728
- sphinx-autobuild>=0.7
29+
- sphinx-panels
2830
- sphinx>=1.5
2931
- typing-extensions>=3.7.4
3032
- watermark

docs/source/_templates/layout.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{% extends "!layout.html" %}
2+
3+
<!-- Hide left sidebar in home page -->
4+
{% block docs_sidebar %}
5+
{% if pagename != 'index' %}
6+
{{ super() }}
7+
{% endif %}
8+
{% endblock %}
9+
10+
<!-- Hide right sidebar in home page -->
11+
{% block docs_toc %}
12+
{% if pagename != 'index' %}
13+
{{ super() }}
14+
{% endif %}
15+
{% endblock %}
16+
17+
<!-- Make body have full width in home page -->
18+
{% block docs_main %}
19+
{% if pagename == 'index' %}
20+
<main class="col-12 py-md-5 pl-md-5 pr-md-4 bd-content" role="main">
21+
{% block body %} {% endblock %}
22+
</main>
23+
{% else %}
24+
{{ super() }}
25+
{% endif %}
26+
{% endblock %}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ version }}

docs/source/conf.py

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"matplotlib.sphinxext.plot_directive",
4040
"sphinx.ext.autodoc",
4141
"sphinx.ext.autosummary",
42+
"sphinx.ext.viewcode",
4243
"sphinx.ext.mathjax",
4344
"sphinx.ext.intersphinx",
4445
"numpydoc",
@@ -48,6 +49,7 @@
4849
"sphinx.ext.napoleon",
4950
"gallery_generator",
5051
"myst_nb",
52+
"sphinx_panels",
5153
]
5254

5355
# Don't auto-generate summary for class members.
@@ -104,7 +106,13 @@
104106
# directories to ignore when looking for source files.
105107
exclude_patterns = ["_build", "**.ipynb_checkpoints"]
106108

109+
# myst and panels config
107110
jupyter_execute_notebooks = "off"
111+
myst_heading_anchors = 3
112+
myst_enable_extensions = [
113+
"colon_fence",
114+
]
115+
panels_add_bootstrap_css = False
108116

109117
# The reST default role (used for this markup: `text`) to use for all
110118
# documents.
@@ -143,26 +151,40 @@
143151

144152
# The theme to use for HTML and HTML Help pages. See the documentation for
145153
# a list of builtin themes.
146-
html_theme_path = ["."]
147-
html_theme = "semantic_sphinx"
154+
html_theme = "pydata_sphinx_theme"
148155

149156

150157
# Theme options are theme-specific and customize the look and feel of a theme
151158
# further. For a list of options available for each theme, see the
152159
# documentation.
153160

154161
html_theme_options = {
155-
"navbar_links": [
156-
("Tutorials", "nb_tutorials/index"),
157-
("Examples", "nb_examples/index"),
158-
("Books + Videos", "learn"),
159-
("API", "api"),
160-
("Developer Guide", "developer_guide"),
161-
("About PyMC3", "about"),
162+
"icon_links": [
163+
{
164+
"name": "GitHub",
165+
"url": "https://github.com/pymc-devs/pymc3",
166+
"icon": "fab fa-github-square",
167+
},
168+
{
169+
"name": "Twitter",
170+
"url": "https://twitter.com/pymc_devs",
171+
"icon": "fab fa-twitter-square",
172+
},
162173
],
163-
# "fixed_sidebar": "false",
164-
# "description": "Probabilistic Programming in Python: Bayesian Modeling and Probabilistic Machine Learning with Aesara"
174+
"show_prev_next": False,
175+
"navbar_start": ["navbar-logo", "navbar-version"],
176+
"navbar_end": ["search-field.html", "navbar-icon-links.html"],
177+
"search_bar_text": "Search...",
178+
"use_edit_page_button": False, # TODO: see how to skip of fix for generated pages
179+
"google_analytics_id": "UA-176578023-1",
180+
}
181+
html_context = {
182+
"github_user": "pymc-devs",
183+
"github_repo": "pymc3",
184+
"github_version": "main",
185+
"doc_path": "docs/source/",
165186
}
187+
html_sidebars = {"learn": [], "**": ["sidebar-nav-bs.html", "sidebar-ethical-ads.html"]}
166188

167189
# Add any paths that contain custom themes here, relative to this directory.
168190
# html_theme_path = []
@@ -202,7 +224,7 @@
202224
# html_use_smartypants = True
203225

204226
# Custom sidebar templates, maps document names to template names.
205-
html_sidebars = {"**": ["about.html", "navigation.html", "searchbox.html"]}
227+
# html_sidebars = {"**": ["about.html", "navigation.html", "searchbox.html"]}
206228

207229
# Additional templates that should be rendered to pages, maps page names to
208230
# template names.
@@ -330,6 +352,6 @@
330352
# texinfo_no_detailmenu = False
331353

332354

333-
def setup(app):
334-
app.add_css_file("https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css")
335-
app.add_css_file("default.css")
355+
# def setup(app):
356+
# app.add_css_file("https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css")
357+
# app.add_css_file("default.css")

docs/source/index.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@
1717
</div>
1818
<div class="eight wide right floated column">
1919

20+
.. toctree::
21+
:maxdepth: 1
22+
:hidden:
23+
24+
Tutorials<nb_tutorials/index>
25+
Examples<nb_examples/index>
26+
Books + Videos<learn>
27+
API<api>
28+
Developer Guide<developer_guide>
29+
About PyMC3<about>
30+
2031
.. code-block:: python
2132
2233
import pymc3 as pm

docs/source/learn.md

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# Learn Bayesian statistics
2+
3+
## ...with others!
4+
5+
:::{list-table}
6+
:header-rows: 0
7+
:widths: 10 150
8+
9+
* - {fa}`discourse,fa-2x,style=fab`
10+
- [Discourse Forum](https://discourse.pymc.io/)
11+
12+
The PyMC3 discourse forum is a great place to ask general questions about Bayesian statistics, or more specific ones about PyMC3 usage.
13+
* - {fa}`meetup,fa-2x,style=fab`
14+
- Conferences
15+
16+
PyMC3 talks have been given at a number of conferences, including [PyCon](https://us.pycon.org/),
17+
[PyData](https://pydata.org/events/), and [ODSC](https://odsc.com/) events.
18+
* - {fa}`python,fa-2x,style=fab`
19+
- [Meetup Groups](https://www.meetup.com/)
20+
21+
Many areas have an local Bayesian, PyData, or Stan meetup.
22+
:::
23+
24+
## ...with a video!
25+
26+
:::{list-table}
27+
:header-rows: 0
28+
:widths: 10 150
29+
30+
* - {fa}`youtube,fa-2x,style=fab`
31+
- [YouTube Playlist](https://www.youtube.com/playlist?list=PL1Ma_1DBbE82OVW8Fz_6Ts1oOeyOAiovy)
32+
33+
There is an actively curated playlist of PyMC3 talks on YouTube.
34+
* - {fa}`youtube,fa-2x,style=fab`
35+
- [Advance Bayesian Modelling with PyMC3](https://github.com/junpenglao/advance-bayesian-modelling-with-PyMC3)
36+
37+
A two days advance workshop in May 2018 @CEAi in the Czech Republic.
38+
:::
39+
40+
## ...with a book!
41+
42+
::::{panels}
43+
:column: col-lg-4 col-md-4
44+
45+
---
46+
:img-top: https://camo.githubusercontent.com/4a0aca82ca82efab71747d00db30f3a68de98e82/687474703a2f2f692e696d6775722e636f6d2f36444b596250622e706e673f31
47+
48+
Bayesian Methods for Hackers
49+
50+
*Cameron Davidson-Pilon*
51+
^^^^^^^^
52+
53+
Fantastic book with many applied code examples.
54+
55+
:::{list-table}
56+
:header-rows: 0
57+
:widths: 4 60
58+
59+
* - [{fa}`link`][hackers source]
60+
- [Github Repo][hackers source]
61+
* - [{fa}`link`][hackers homepage]
62+
- [Project Homepage][hackers homepage]
63+
:::
64+
65+
---
66+
:img-top: https://lh3.googleusercontent.com/qU5yWpiVSkujyCnRZhQo8cBUrW_3e_7Cx4jEs5yfpmMbEEuDnxTGOELhy2x7F7qkwFwQJ4pFYNszZhNpN1jCSdrdHsVUHtf1Mg6F8qwb3SQe1TDE=w1280
67+
68+
Doing Bayesian Data Analysis
69+
70+
*John Kruschke*
71+
^^^^^^^^
72+
73+
Principled introduction to Bayesian data analysis.
74+
75+
:::{list-table}
76+
:header-rows: 0
77+
:widths: 4 60
78+
79+
* - [{fa}`link`][dbda website]
80+
- [Book Website][dbda website]
81+
* - [{fa}`link`][dbda 1st ed nb]
82+
- [PyMC3 notebooks for *first edition*][dbda 1st ed nb]
83+
* - [{fa}`link`][dbda 2nd ed nb]
84+
- [PyMC3 notebooks for *second edition*][dbda 2nd ed nb]
85+
:::
86+
87+
---
88+
:img-top: http://xcelab.net/rm/wp-content/uploads/2012/01/9781482253443-191x300.jpg
89+
90+
Statistical Rethingking
91+
92+
*Richard McElreath*
93+
^^^^^^^^
94+
95+
A Bayesian Course with Examples in R and Stan.
96+
97+
:::{list-table}
98+
:header-rows: 0
99+
:widths: 4 60
100+
101+
* - [{fa}`link`][rethinking website]
102+
- [Book Website][rethinking website]
103+
* - [{fa}`link`][rethinking port]
104+
- [PyMC3 port of the code][rethinking port]
105+
:::
106+
107+
---
108+
:img-top: https://raw.githubusercontent.com/aloctavodia/BAP/master/Cover.png
109+
110+
Bayesian Analysis with Python
111+
112+
*Osvaldo Martin*
113+
^^^^^^^^
114+
115+
A great introductory book written by a maintainer of PyMC3.
116+
117+
:::{list-table}
118+
:header-rows: 0
119+
:widths: 4 60
120+
121+
* - [{fa}`link`][bap website]
122+
- [Book Website][bap website]
123+
* - [{fa}`link`][bap code]
124+
- [Code and errata in PyMC3][bap code]
125+
:::
126+
127+
---
128+
:img-top: https://images-na.ssl-images-amazon.com/images/I/51K33XI2I8L._SX330_BO1,204,203,200_.jpg
129+
130+
Bayesian Cognitive Modeling: A Practical Course
131+
132+
*Michael Lee and Eric-Jan Wagenmakers*
133+
^^^^^^^^
134+
135+
Focused on using Bayesian statistics in cognitive modeling.
136+
137+
:::{list-table}
138+
:header-rows: 0
139+
:widths: 4 60
140+
141+
* - [{fa}`link`][bcm website]
142+
- [Book Website][bcm website]
143+
* - [{fa}`link`][bcm code]
144+
- [PyMC3 implementation][bcm code]
145+
:::
146+
147+
---
148+
:img-top: http://www.stat.columbia.edu/~gelman/book/bda_cover.png
149+
150+
Bayesian Data Analysis
151+
152+
*Andrew Gelman, John Carlin, Hal Stern, David Dunson, Aki Vehtari, and Donald Rubin*
153+
^^^^^^^^
154+
155+
A comprehensive, standard, and wonderful textbook on Bayesian methods.
156+
157+
:::{list-table}
158+
:header-rows: 0
159+
:widths: 4 60
160+
161+
* - [{fa}`link`][bda3 website]
162+
- [Book Website][bda3 website]
163+
* - [{fa}`link`][bda3 port]
164+
- [Examples and exercises implemented in PyMC3][bda3 port]
165+
:::
166+
167+
::::
168+
169+
170+
[hackers source]: https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers
171+
[hackers homepage]: http://camdavidsonpilon.github.io/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/
172+
[dbda website]: https://sites.google.com/site/doingbayesiandataanalysis/home
173+
[dbda 1st ed nb]: https://github.com/aloctavodia/Doing_bayesian_data_analysis
174+
[dbda 2nd ed nb]: https://github.com/JWarmenhoven/DBDA-python
175+
[rethinking website]: http://xcelab.net/rm/statistical-rethinking/
176+
[rethinking port]: https://github.com/pymc-devs/resources/tree/master/Rethinking
177+
[bap website]: https://www.packtpub.com/big-data-and-business-intelligence/bayesian-analysis-python-second-edition
178+
[bap code]: https://github.com/aloctavodia/BAP
179+
[bcm website]: https://bayesmodels.com/
180+
[bcm code]: https://github.com/pymc-devs/resources/tree/master/BCM
181+
[bda3 website]: https://www.stat.columbia.edu/~gelman/book/
182+
[bda3 port]: https://github.com/pymc-devs/resources/tree/master/BDA3

0 commit comments

Comments
 (0)