From ee9e77122ee7e8375cea63fdf840d82f06163f56 Mon Sep 17 00:00:00 2001 From: Sayam753 Date: Sat, 26 Jun 2021 00:43:27 +0530 Subject: [PATCH 01/12] Add readthedocs yml file --- .readthedocs.yml | 13 +++++++++++++ docs/source/pymc-examples | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000000..23370a287f --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,13 @@ +version: 2 + +sphinx: + configuration: docs/source/conf.py + +python: + version: 3.7 + install: + - requirements: requirements-dev.txt + +submodules: + include: all + recursive: true diff --git a/docs/source/pymc-examples b/docs/source/pymc-examples index a093bcc5aa..f99e8797b3 160000 --- a/docs/source/pymc-examples +++ b/docs/source/pymc-examples @@ -1 +1 @@ -Subproject commit a093bcc5aa828e9317bdf9f936f968f76acdb4f7 +Subproject commit f99e8797b3f50210280e461993a9664914f98161 From fa740ab015f4ddfa7ed717cd8169a6b501b44423 Mon Sep 17 00:00:00 2001 From: Sayam753 Date: Sat, 26 Jun 2021 01:00:13 +0530 Subject: [PATCH 02/12] Add installation of pymc3 --- .readthedocs.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.readthedocs.yml b/.readthedocs.yml index 23370a287f..70d4c5250a 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -7,6 +7,9 @@ python: version: 3.7 install: - requirements: requirements-dev.txt + - method: pip + path: . + submodules: include: all From 6ab3f48d32acd49bda4139cb33397365db43b094 Mon Sep 17 00:00:00 2001 From: Sayam753 Date: Sun, 27 Jun 2021 17:11:36 +0530 Subject: [PATCH 03/12] Manually invoke building gallery instead of using it as an extension --- docs/source/conf.py | 7 ++++++- docs/source/pymc-examples | 2 +- docs/source/sphinxext/gallery_generator.py | 9 --------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 9b23a323af..3cbd8b0bea 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -15,6 +15,8 @@ import os import sys +from pathlib import Path + import pymc3 # If extensions (or modules to document with autodoc) are in another directory, @@ -23,6 +25,8 @@ sys.path.insert(0, os.path.abspath(os.path.join("..", ".."))) sys.path.insert(0, os.path.abspath("sphinxext")) +from gallery_generator import build_gallery + # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. @@ -43,7 +47,6 @@ "IPython.sphinxext.ipython_directive", "sphinx.ext.autosectionlabel", "sphinx.ext.napoleon", - "gallery_generator", "recommonmark", ] @@ -330,3 +333,5 @@ def setup(app): app.add_css_file("https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css") app.add_css_file("default.css") + for gallery in ("tutorials", "examples"): + build_gallery(Path(__file__).parent, gallery) diff --git a/docs/source/pymc-examples b/docs/source/pymc-examples index f99e8797b3..b51d2e8a80 160000 --- a/docs/source/pymc-examples +++ b/docs/source/pymc-examples @@ -1 +1 @@ -Subproject commit f99e8797b3f50210280e461993a9664914f98161 +Subproject commit b51d2e8a80894800a39ef5017bcc4268366ea6bb diff --git a/docs/source/sphinxext/gallery_generator.py b/docs/source/sphinxext/gallery_generator.py index caf4beb450..696d5eefe3 100644 --- a/docs/source/sphinxext/gallery_generator.py +++ b/docs/source/sphinxext/gallery_generator.py @@ -200,12 +200,3 @@ def build_gallery(srcdir, gallery): ) os.chdir(working_dir) - - -def main(app): - for gallery in ("tutorials", "examples"): - build_gallery(app.builder.srcdir, gallery) - - -def setup(app): - app.connect("builder-inited", main) From 97d837f805ad8bffb9682770d4175da3d9e0eac1 Mon Sep 17 00:00:00 2001 From: Sayam753 Date: Sun, 27 Jun 2021 18:45:55 +0530 Subject: [PATCH 04/12] Trying to fix relative paths --- docs/source/sphinxext/gallery_generator.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/source/sphinxext/gallery_generator.py b/docs/source/sphinxext/gallery_generator.py index 696d5eefe3..9cf44cb5dd 100644 --- a/docs/source/sphinxext/gallery_generator.py +++ b/docs/source/sphinxext/gallery_generator.py @@ -170,16 +170,20 @@ def build_gallery(srcdir, gallery): if basename.find(".rst") < 1: filename = os.path.join(source_dir, basename + ".ipynb") ex = NotebookGenerator(filename, target_dir) + url = Path(os.path.join(os.sep, gallery, ex.output_html)) + url = "../" + str(Path(*url.parts[3:])) data[basename] = { "title": ex.pagetitle, - "url": os.path.join(os.sep, gallery, ex.output_html), + "url": url, "thumb": os.path.basename(ex.png_path), } else: filename = basename.split(".")[0] + url = Path(os.path.join(os.sep, gallery, "../" + filename + ".html")) + url = "../" + str(Path(*url.parts[3:])) data[basename] = { "title": " ".join(filename.split("_")), - "url": os.path.join(os.sep, gallery, "../" + filename + ".html"), + "url": url, "thumb": os.path.basename(default_png_path), } From f94270db43976717ee1e4b3c5e4e7660bd0ba41a Mon Sep 17 00:00:00 2001 From: Sayam753 Date: Sat, 3 Jul 2021 13:20:07 +0530 Subject: [PATCH 05/12] Temporarily disable tests --- .github/workflows/arviz_compat.yml | 2 +- .github/workflows/jaxtests.yml | 2 +- .github/workflows/pre-commit.yml | 2 +- .github/workflows/pytest.yml | 2 +- .github/workflows/windows.yml | 2 +- docs/source/pymc-examples | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/arviz_compat.yml b/.github/workflows/arviz_compat.yml index f4709169ac..5d31808629 100644 --- a/.github/workflows/arviz_compat.yml +++ b/.github/workflows/arviz_compat.yml @@ -1,7 +1,7 @@ name: arviz-compatibility on: - pull_request: + # pull_request: push: branches: [v3] diff --git a/.github/workflows/jaxtests.yml b/.github/workflows/jaxtests.yml index 5bd89e3a27..e9bc29c401 100644 --- a/.github/workflows/jaxtests.yml +++ b/.github/workflows/jaxtests.yml @@ -1,7 +1,7 @@ name: jax-sampling on: - pull_request: + # pull_request: push: branches: [v3] diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 88ea331924..59da304d91 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,7 +1,7 @@ name: pre-commit on: - pull_request: + # pull_request: push: branches: [v3] diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 338847271a..38ba9060cc 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -1,7 +1,7 @@ name: pytest on: - pull_request: + # pull_request: push: branches: [v3] diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index be9df7ff4b..b405989d4f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,7 +1,7 @@ name: windows on: - pull_request: + # pull_request: push: branches: [v3] diff --git a/docs/source/pymc-examples b/docs/source/pymc-examples index b51d2e8a80..dafc41c0f8 160000 --- a/docs/source/pymc-examples +++ b/docs/source/pymc-examples @@ -1 +1 @@ -Subproject commit b51d2e8a80894800a39ef5017bcc4268366ea6bb +Subproject commit dafc41c0f8f174190a98630a8a0df2c4c241f4ce From c3001f343e95b5778fb89c0d33737456dba2a4ba Mon Sep 17 00:00:00 2001 From: Sayam753 Date: Sat, 3 Jul 2021 14:34:14 +0530 Subject: [PATCH 06/12] Bring back the gallery extension. Just create the required directories for sphinx to build tutorials and examples section --- docs/source/conf.py | 8 ++++---- docs/source/sphinxext/gallery_generator.py | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 3cbd8b0bea..ea3832a56e 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -25,8 +25,6 @@ sys.path.insert(0, os.path.abspath(os.path.join("..", ".."))) sys.path.insert(0, os.path.abspath("sphinxext")) -from gallery_generator import build_gallery - # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. @@ -47,6 +45,7 @@ "IPython.sphinxext.ipython_directive", "sphinx.ext.autosectionlabel", "sphinx.ext.napoleon", + "gallery_generator", "recommonmark", ] @@ -333,5 +332,6 @@ def setup(app): app.add_css_file("https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css") app.add_css_file("default.css") - for gallery in ("tutorials", "examples"): - build_gallery(Path(__file__).parent, gallery) + dir_root = Path(__file__).parent + for directory in ["_static", "nb_tutorials/_images", "nb_examples/_images"]: + os.makedirs(str(dir_root / directory)) diff --git a/docs/source/sphinxext/gallery_generator.py b/docs/source/sphinxext/gallery_generator.py index 9cf44cb5dd..1932e9c90a 100644 --- a/docs/source/sphinxext/gallery_generator.py +++ b/docs/source/sphinxext/gallery_generator.py @@ -204,3 +204,12 @@ def build_gallery(srcdir, gallery): ) os.chdir(working_dir) + + +def main(app): + for gallery in ("tutorials", "examples"): + build_gallery(app.builder.srcdir, gallery) + + +def setup(app): + app.connect("builder-inited", main) From dd33464554cb4212c0a9e8d3f58e5fe55a2a97cc Mon Sep 17 00:00:00 2001 From: Sayam753 Date: Sat, 3 Jul 2021 14:55:44 +0530 Subject: [PATCH 07/12] Fixup a bug when expected static directories are already present; Simplified to use existing directories path --- docs/source/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index ea3832a56e..6fc8780e8b 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -333,5 +333,5 @@ def setup(app): app.add_css_file("https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css") app.add_css_file("default.css") dir_root = Path(__file__).parent - for directory in ["_static", "nb_tutorials/_images", "nb_examples/_images"]: - os.makedirs(str(dir_root / directory)) + for directory in html_static_path: + os.makedirs(str(dir_root / directory), exist_ok=True) From 154823c409a94a9e70b32aa62322a72e6e1cf7e9 Mon Sep 17 00:00:00 2001 From: Sayam753 Date: Sat, 3 Jul 2021 19:28:54 +0530 Subject: [PATCH 08/12] Simplified relative urls handling --- docs/source/sphinxext/gallery_generator.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/source/sphinxext/gallery_generator.py b/docs/source/sphinxext/gallery_generator.py index 1932e9c90a..46273e04d6 100644 --- a/docs/source/sphinxext/gallery_generator.py +++ b/docs/source/sphinxext/gallery_generator.py @@ -171,16 +171,19 @@ def build_gallery(srcdir, gallery): filename = os.path.join(source_dir, basename + ".ipynb") ex = NotebookGenerator(filename, target_dir) url = Path(os.path.join(os.sep, gallery, ex.output_html)) - url = "../" + str(Path(*url.parts[3:])) + # Need to chop off "/${gallery}/../" so as redirection works in multi versioned docs. + url = str(Path("..", *url.parts[3:])) data[basename] = { "title": ex.pagetitle, "url": url, "thumb": os.path.basename(ex.png_path), } + else: filename = basename.split(".")[0] url = Path(os.path.join(os.sep, gallery, "../" + filename + ".html")) - url = "../" + str(Path(*url.parts[3:])) + # Need to chop off "/${gallery}/../" so as redirection works in multi versioned docs. + url = str(Path("..", *url.parts[3:])) data[basename] = { "title": " ".join(filename.split("_")), "url": url, From 4b59f6e036ceeede5b5ff646784ce20e3df47d5e Mon Sep 17 00:00:00 2001 From: Sayam753 Date: Sat, 3 Jul 2021 19:53:45 +0530 Subject: [PATCH 09/12] Given a mention in release notes --- RELEASE-NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index aab5e1bb1f..6c47a4751f 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -6,6 +6,7 @@ + `theano.printing.pydotprint` is now hotfixed upon import (see [#4594](https://github.com/pymc-devs/pymc3/pull/4594)). + Fix bug in the computation of the log pseudolikelihood values (SMC-ABC). (see [#4672](https://github.com/pymc-devs/pymc3/pull/4672)). + Fix `LKJCorr.random` method to work with `pm.sample_prior_predictive`. (see [#4780](https://github.com/pymc-devs/pymc3/pull/4780)) ++ Enable documentation generation via ReadTheDocs for upcoming v3 releases. (see [#4805](https://github.com/pymc-devs/pymc3/pull/4805)). ### New Features + 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 From 9aee07cb2ca647aae2021ea551ec5002105dfc13 Mon Sep 17 00:00:00 2001 From: Sayam753 Date: Sat, 3 Jul 2021 20:16:36 +0530 Subject: [PATCH 10/12] Add installation links to landing page --- docs/source/index.rst | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index 053e1962f1..e0299667a2 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -44,28 +44,28 @@
-

Installation

- -
-
-

Via conda-forge:

- -.. code-block:: bash - - conda install -c conda-forge pymc3 - - -.. raw:: html - -

Latest (unstable):

+
+

Installation

+
-.. code-block:: bash + +
+
Instructions for Linux
+
+
- pip install git+https://github.com/pymc-devs/pymc3 + +
+
Instructions for MacOS
+
+
-.. raw:: html + +
+
Instructions for Windows
+
+
-
From a4e3be4745fad4e5389181c25b86c8b525e519e4 Mon Sep 17 00:00:00 2001 From: Sayam753 Date: Sat, 3 Jul 2021 21:34:06 +0530 Subject: [PATCH 11/12] Re-enable tests and update pymc-examples submodule --- .github/workflows/arviz_compat.yml | 2 +- .github/workflows/jaxtests.yml | 2 +- .github/workflows/pre-commit.yml | 2 +- .github/workflows/pytest.yml | 2 +- .github/workflows/windows.yml | 2 +- docs/source/pymc-examples | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/arviz_compat.yml b/.github/workflows/arviz_compat.yml index 5d31808629..f4709169ac 100644 --- a/.github/workflows/arviz_compat.yml +++ b/.github/workflows/arviz_compat.yml @@ -1,7 +1,7 @@ name: arviz-compatibility on: - # pull_request: + pull_request: push: branches: [v3] diff --git a/.github/workflows/jaxtests.yml b/.github/workflows/jaxtests.yml index e9bc29c401..5bd89e3a27 100644 --- a/.github/workflows/jaxtests.yml +++ b/.github/workflows/jaxtests.yml @@ -1,7 +1,7 @@ name: jax-sampling on: - # pull_request: + pull_request: push: branches: [v3] diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 59da304d91..88ea331924 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,7 +1,7 @@ name: pre-commit on: - # pull_request: + pull_request: push: branches: [v3] diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 38ba9060cc..338847271a 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -1,7 +1,7 @@ name: pytest on: - # pull_request: + pull_request: push: branches: [v3] diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index b405989d4f..be9df7ff4b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,7 +1,7 @@ name: windows on: - # pull_request: + pull_request: push: branches: [v3] diff --git a/docs/source/pymc-examples b/docs/source/pymc-examples index dafc41c0f8..0bbf199c46 160000 --- a/docs/source/pymc-examples +++ b/docs/source/pymc-examples @@ -1 +1 @@ -Subproject commit dafc41c0f8f174190a98630a8a0df2c4c241f4ce +Subproject commit 0bbf199c462a65e3c9a7b5155f7b47c69eae2581 From 7569d8c59c08df824690f8cff74cb4dd0034e830 Mon Sep 17 00:00:00 2001 From: Sayam753 Date: Sat, 3 Jul 2021 22:13:00 +0530 Subject: [PATCH 12/12] Fix relative links for in-depth guides --- docs/source/index.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index e0299667a2..205f8ee902 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -73,7 +73,7 @@

In-Depth Guides