Skip to content

Commit cb6f5b2

Browse files
authored
Move from nbsphinx to myst-nb (#4759)
* move from nbsphinx to myst-nb * fix some doc rendering errors * fix fast_doc_build * update conda envs
1 parent 9e0e584 commit cb6f5b2

9 files changed

+20
-20
lines changed

conda-envs/environment-dev-py37.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
- ipython>=7.16
88
- libblas=*=*mkl
99
- mkl-service
10-
- nbsphinx>=0.4
10+
- myst-nb
1111
- numpy=1.15
1212
- numpydoc>=0.9
1313
- pandas=0.24
@@ -16,7 +16,6 @@ dependencies:
1616
- pytest>=3.0
1717
- python-graphviz
1818
- python=3.7
19-
- recommonmark>=0.4
2019
- scipy=1.2
2120
- sphinx-autobuild>=0.7
2221
- sphinx>=1.5

conda-envs/environment-dev-py38.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ dependencies:
77
- ipython>=7.16
88
- libblas=*=*mkl
99
- mkl-service
10-
- nbsphinx>=0.4
10+
- myst-nb
1111
- numpydoc>=0.9
1212
- pre-commit>=2.8.0
1313
- pytest-cov>=2.5
1414
- pytest>=3.0
1515
- python-graphviz
1616
- python=3.8
17-
- recommonmark>=0.4
1817
- sphinx-autobuild>=0.7
1918
- sphinx>=1.5
2019
- watermark

conda-envs/environment-dev-py39.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ dependencies:
77
- ipython>=7.16
88
- libblas=*=*mkl
99
- mkl-service
10-
- nbsphinx>=0.4
10+
- myst-nb
1111
- numpydoc>=0.9
1212
- pre-commit>=2.8.0
1313
- pytest-cov>=2.5
1414
- pytest>=3.0
1515
- python-graphviz
1616
- python=3.9
17-
- recommonmark>=0.4
1817
- sphinx-autobuild>=0.7
1918
- sphinx>=1.5
2019
- watermark

docs/source/conf.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
""" Sphinx configuration file.
2+
3+
isort:skip_file
4+
"""
15
#!/usr/bin/env python3
26
#
37
# pymc3 documentation build configuration file, created by
@@ -15,13 +19,13 @@
1519
import os
1620
import sys
1721

18-
import pymc3
1922

2023
# If extensions (or modules to document with autodoc) are in another directory,
2124
# add these directories to sys.path here. If the directory is relative to the
2225
# documentation root, use os.path.abspath to make it absolute, like shown here.
2326
sys.path.insert(0, os.path.abspath(os.path.join("..", "..")))
2427
sys.path.insert(0, os.path.abspath("sphinxext"))
28+
import pymc3 # isort:skip
2529

2630
# -- General configuration ------------------------------------------------
2731

@@ -37,14 +41,13 @@
3741
"sphinx.ext.autosummary",
3842
"sphinx.ext.mathjax",
3943
"sphinx.ext.intersphinx",
40-
"nbsphinx",
4144
"numpydoc",
4245
"IPython.sphinxext.ipython_console_highlighting",
4346
"IPython.sphinxext.ipython_directive",
4447
"sphinx.ext.autosectionlabel",
4548
"sphinx.ext.napoleon",
4649
"gallery_generator",
47-
"recommonmark",
50+
"myst_nb",
4851
]
4952

5053
# Don't auto-generate summary for class members.
@@ -72,8 +75,8 @@
7275

7376
# General information about the project.
7477
project = "PyMC3"
75-
copyright = "2018, The PyMC Development Team"
76-
author = "PyMC developers"
78+
copyright = "2021, The PyMC Development Team"
79+
author = "PyMC contributors"
7780

7881
# The version info for the project you're documenting, acts as replacement for
7982
# |version| and |release|, also used in various other places throughout the
@@ -101,7 +104,7 @@
101104
# directories to ignore when looking for source files.
102105
exclude_patterns = ["_build", "**.ipynb_checkpoints"]
103106

104-
nbsphinx_execute = "never"
107+
jupyter_execute_notebooks = "off"
105108

106109
# The reST default role (used for this markup: `text`) to use for all
107110
# documents.

fast_build_docs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
git --git-dir=docs/source/pymc-examples/.git --work-tree=docs/source/pymc-examples checkout fast-docs-build
3+
git --git-dir=docs/source/pymc-examples/.git --work-tree=docs/source/pymc-examples checkout main
44
pushd docs/source
55
make clean
66
make html

pymc3/distributions/multivariate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ class DirichletMultinomial(Discrete):
531531
532532
.. math::
533533
534-
f(x \mid n, a) = \frac{\Gamma(n + 1)\Gamma(\sum a_k)}
534+
f(x \mid n, a) = \frac{\Gamma(n + 1)\Gamma(\sum a_k)}
535535
{\Gamma(\n + \sum a_k)}
536536
\prod_{k=1}^K
537537
\frac{\Gamma(x_k + a_k)}

pymc3/distributions/timeseries.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ def random(self, point=None, size=None):
486486
487487
Examples
488488
-------
489+
489490
.. code-block:: python
490491
491492
with pm.Model():
@@ -502,6 +503,7 @@ def random(self, point=None, size=None):
502503
# draw four samples from a 2-dimensional Gaussian random walk with 10 timesteps,
503504
# indexed with a (2, 2) array
504505
sample = MvGaussianRandomWalk(mu, cov, shape=(10, 2)).random(size=(2, 2))
506+
505507
"""
506508

507509
# for each draw specified by the size input, we need to draw time_steps many

pymc3/math.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,9 @@ def log1mexp(x):
241241
https://cran.r-project.org/web/packages/Rmpfr/vignettes/log1mexp-note.pdf
242242
243243
References
244-
----------
245-
.. [Machler2012] Martin Mächler (2012).
246-
"Accurately computing `\log(1-\exp(- \mid a \mid))` Assessed by the Rmpfr
247-
package"
244+
----------
245+
.. [Machler2012] Martin Mächler (2012).
246+
"Accurately computing `\log(1-\exp(- \mid a \mid))` Assessed by the Rmpfr package"
248247
249248
"""
250249
return at.switch(at.lt(x, 0.6931471805599453), at.log(-at.expm1(-x)), at.log1p(-at.exp(-x)))

requirements-dev.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33

44
h5py>=2.7
55
ipython>=7.16
6-
nbsphinx>=0.4
6+
myst-nb
77
numpydoc>=0.9
88
pre-commit>=2.8.0
99
pytest-cov>=2.5
1010
pytest>=3.0
11-
recommonmark>=0.4
1211
sphinx-autobuild>=0.7
1312
sphinx>=1.5
1413
watermark

0 commit comments

Comments
 (0)