|
1 |
| -# -*- coding: utf-8 -*- |
2 |
| -# |
3 |
| -# Configuration file for the Sphinx documentation builder. |
4 |
| -# |
5 |
| -# This file does only contain a selection of the most common options. For a |
6 |
| -# full list see the documentation: |
7 |
| -# http://www.sphinx-doc.org/en/master/config |
8 |
| - |
9 |
| -# -- Path setup -------------------------------------------------------------- |
10 |
| - |
11 |
| -# If extensions (or modules to document with autodoc) are in another directory, |
12 |
| -# add these directories to sys.path here. If the directory is relative to the |
13 |
| -# documentation root, use os.path.abspath to make it absolute, like shown here. |
14 |
| -# |
15 |
| -import os |
16 |
| -import sys |
17 |
| - |
18 |
| -from pymc_bart import __version__ |
19 |
| - |
20 |
| -sys.path.insert(0, os.path.abspath("../")) |
| 1 | +import os, sys |
| 2 | +from pathlib import Path |
| 3 | +from sphinx.application import Sphinx |
21 | 4 |
|
22 | 5 | # -- Project information -----------------------------------------------------
|
23 |
| - |
24 |
| -project = "pymc_bart" |
25 |
| -copyright = "2022, pymc-devs" |
26 |
| -author = "pymc-devs" |
27 |
| - |
28 |
| -# The short X.Y version |
29 |
| -version = __version__ |
30 |
| -# The full version, including alpha/beta/rc tags |
31 |
| -release = __version__ |
32 |
| - |
| 6 | +project = "PyMC-BART" |
| 7 | +copyright = "2022, PyMC Community" |
| 8 | +author = "PyMC Community" |
33 | 9 |
|
34 | 10 | # -- General configuration ---------------------------------------------------
|
35 | 11 |
|
36 |
| -# If your documentation needs a minimal Sphinx version, state it here. |
37 |
| -# |
38 |
| -# needs_sphinx = '1.0' |
| 12 | +sys.path.insert(0, os.path.abspath("../sphinxext")) |
39 | 13 |
|
40 | 14 | # Add any Sphinx extension module names here, as strings. They can be
|
41 | 15 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
42 | 16 | # ones.
|
43 | 17 | extensions = [
|
44 |
| - "sphinx.ext.autodoc", |
45 |
| - "sphinx.ext.viewcode", |
46 |
| - "sphinx.ext.napoleon", |
| 18 | + "sphinx.ext.intersphinx", |
47 | 19 | "sphinx.ext.mathjax",
|
48 |
| - "nbsphinx", |
| 20 | + "myst_nb", |
| 21 | + "sphinx_design", |
| 22 | + "sphinxcontrib.bibtex", |
| 23 | + "sphinx_codeautolink", |
| 24 | + "sphinx_remove_toctrees", |
49 | 25 | ]
|
50 | 26 |
|
51 |
| -external_docs = ["examples/BART_introduction.ipynb", "examples/references.bib"] |
52 |
| -for doc in external_docs: |
53 |
| - if os.path.exists(doc): |
54 |
| - os.remove(doc) |
| 27 | +# List of patterns, relative to source directory, that match files and |
| 28 | +# directories to ignore when looking for source files. |
| 29 | +# This pattern also affects html_static_path and html_extra_path. |
| 30 | +exclude_patterns = [ |
| 31 | + "_build", |
| 32 | + "Thumbs.db", |
| 33 | + ".DS_Store", |
| 34 | + "*import_posts*", |
| 35 | + "**/.ipynb_checkpoints/*", |
| 36 | + "**/*.myst.md", |
| 37 | +] |
| 38 | + |
| 39 | +if os.path.exists("examples"): |
| 40 | + external_docs = os.listdir("examples") |
| 41 | + for doc in external_docs: |
| 42 | + file = Path("examples", doc) |
| 43 | + if os.path.exists(file): |
| 44 | + os.remove(file) |
55 | 45 |
|
56 | 46 | os.system("wget https://raw.githubusercontent.com/pymc-devs/pymc-examples/main/examples/case_studies/BART_introduction.ipynb -P examples")
|
| 47 | +os.system("wget https://raw.githubusercontent.com/pymc-devs/pymc-examples/main/examples/case_studies/BART_quantile_regression.ipynb -P examples") |
| 48 | +os.system("wget https://raw.githubusercontent.com/pymc-devs/pymc-examples/main/examples/case_studies/bart_heteroscedasticity.ipynb -P examples") |
57 | 49 | os.system("wget https://raw.githubusercontent.com/pymc-devs/pymc-examples/main/examples/references.bib -P examples")
|
58 | 50 |
|
59 | 51 | # bibtex config
|
60 |
| -bibtex_bibfiles = ["references.bib"] |
| 52 | +bibtex_bibfiles = ["examples/references.bib"] |
61 | 53 | bibtex_default_style = "unsrt"
|
62 | 54 | bibtex_reference_style = "author_year"
|
63 | 55 |
|
64 |
| -nbsphinx_execute = "never" |
65 |
| - |
66 |
| -# Add any paths that contain templates here, relative to this directory. |
67 |
| -# templates_path = ["_templates"] |
68 |
| - |
69 |
| -# The suffix(es) of source filenames. |
70 |
| -# You can specify multiple suffix as a list of string: |
71 |
| -# |
72 |
| -source_suffix = ['.rst', '.md'] |
73 |
| - |
74 |
| -# The master toctree document. |
75 |
| -master_doc = "index" |
76 |
| - |
77 |
| -# The language for content autogenerated by Sphinx. Refer to documentation |
78 |
| -# for a list of supported languages. |
79 |
| -# |
80 |
| -# This is also used if you do content translation via gettext catalogs. |
81 |
| -# Usually you set "language" from the command line for these cases. |
82 |
| -language = None |
83 |
| - |
84 |
| -# List of patterns, relative to source directory, that match files and |
85 |
| -# directories to ignore when looking for source files. |
86 |
| -# This pattern also affects html_static_path and html_extra_path. |
87 |
| -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "**.ipynb_checkpoints"] |
88 |
| - |
89 |
| -# The name of the Pygments (syntax highlighting) style to use. |
90 |
| -pygments_style = "sphinx" |
91 |
| - |
92 |
| - |
93 | 56 | # -- Options for HTML output -------------------------------------------------
|
94 | 57 |
|
95 | 58 | # The theme to use for HTML and HTML Help pages. See the documentation for
|
96 | 59 | # a list of builtin themes.
|
97 |
| -# |
98 |
| -html_theme = "pydata_sphinx_theme" |
99 |
| - |
100 |
| -# Theme options are theme-specific and customize the look and feel of a theme |
101 |
| -# further. For a list of options available for each theme, see the |
102 |
| -# documentation. |
103 |
| - |
104 |
| -# https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/configuring.html#remove-the-sidebar-from-some-pages |
105 | 60 |
|
| 61 | +# theme options |
| 62 | +html_theme = "pymc_sphinx_theme" |
106 | 63 | html_theme_options = {
|
107 |
| - "collapse_navigation": True, |
108 |
| - "show_toc_level": 2, |
109 |
| - "navigation_depth": 4, |
110 |
| - "search_bar_text": "Search the docs...", |
111 |
| - "icon_links": [ |
112 |
| - { |
113 |
| - "name": "GitHub", |
114 |
| - "url": "https://github.com/pymc-devs/pymc-bart", |
115 |
| - "icon": "fab fa-github-square", |
116 |
| - }, |
117 |
| - ], |
| 64 | + "secondary_sidebar_items": ["page-toc", "edit-this-page", "sourcelink", "donate"], |
| 65 | + "navbar_start": ["navbar-logo"], |
| 66 | +} |
| 67 | +version = os.environ.get("READTHEDOCS_VERSION", "") |
| 68 | +version = version if "." in version else "main" |
| 69 | +html_context = { |
| 70 | + "github_url": "https://github.com", |
| 71 | + "github_user": "pymc-devs", |
| 72 | + "github_repo": "pymc-bart", |
| 73 | + "github_version": version, |
| 74 | + "default_mode": "light", |
118 | 75 | }
|
119 | 76 |
|
| 77 | + |
| 78 | +html_favicon = "../_static/PyMC.ico" |
| 79 | +html_logo = "../_static/PyMC.png" |
| 80 | +html_title = "PyMC-BART" |
| 81 | + |
120 | 82 | # Add any paths that contain custom static files (such as style sheets) here,
|
121 | 83 | # relative to this directory. They are copied after the builtin static files,
|
122 | 84 | # so a file named "default.css" will overwrite the builtin "default.css".
|
123 |
| -html_static_path = ["_static"] |
124 |
| - |
125 |
| -# -- Options for HTMLHelp output --------------------------------------------- |
126 |
| - |
127 |
| -# Output file base name for HTML help builder. |
128 |
| -htmlhelp_basename = "pymc_bartdoc" |
129 |
| - |
130 |
| - |
131 |
| -# -- Options for LaTeX output ------------------------------------------------ |
132 |
| - |
133 |
| -latex_elements = { |
134 |
| - # The paper size ('letterpaper' or 'a4paper'). |
135 |
| - # |
136 |
| - # 'papersize': 'letterpaper', |
137 |
| - # The font size ('10pt', '11pt' or '12pt'). |
138 |
| - # |
139 |
| - # 'pointsize': '10pt', |
140 |
| - # Additional stuff for the LaTeX preamble. |
141 |
| - # |
142 |
| - # 'preamble': '', |
143 |
| - # Latex figure (float) alignment |
144 |
| - # |
145 |
| - # 'figure_align': 'htbp', |
| 85 | +html_static_path = ["../_static"] |
| 86 | +html_extra_path = ["../_thumbnails"] |
| 87 | +templates_path = ["../_templates"] |
| 88 | +html_sidebars = { |
| 89 | + "**": [ |
| 90 | + "sidebar-nav-bs.html", |
| 91 | + ], |
146 | 92 | }
|
147 | 93 |
|
148 |
| -# Grouping the document tree into LaTeX files. List of tuples |
149 |
| -# (source start file, target name, title, |
150 |
| -# author, documentclass [howto, manual, or own class]). |
151 |
| -latex_documents = [ |
152 |
| - (master_doc, "pymc_bart.tex", "pymc_bart Documentation", "The developers of pymc_bart", "manual"), |
153 |
| -] |
154 |
| - |
155 |
| - |
156 |
| -# -- Options for manual page output ------------------------------------------ |
157 |
| - |
158 |
| -# One entry per manual page. List of tuples |
159 |
| -# (source start file, name, description, authors, manual section). |
160 |
| -man_pages = [(master_doc, "pymc_bart", "pymc_bart Documentation", [author], 1)] |
161 |
| - |
162 |
| - |
163 |
| -# -- Options for Texinfo output ---------------------------------------------- |
164 |
| - |
165 |
| -# Grouping the document tree into Texinfo files. List of tuples |
166 |
| -# (source start file, target name, title, author, |
167 |
| -# dir menu entry, description, category) |
168 |
| -texinfo_documents = [ |
169 |
| - ( |
170 |
| - master_doc, |
171 |
| - "pymc_bart", |
172 |
| - "pymc_bart Documentation", |
173 |
| - author, |
174 |
| - "pymc_bart", |
175 |
| - "One line description of project.", |
176 |
| - "Miscellaneous", |
177 |
| - ), |
| 94 | +# MyST config |
| 95 | +myst_enable_extensions = ["colon_fence", "deflist", "dollarmath", "amsmath", "substitution"] |
| 96 | +citation_code = f""" |
| 97 | +```bibtex |
| 98 | +@incollection{{citekey, |
| 99 | + author = "<notebook authors, see above>", |
| 100 | + title = "<notebook title>", |
| 101 | + editor = "PyMC Team", |
| 102 | + booktitle = "PyMC examples", |
| 103 | +}} |
| 104 | +``` |
| 105 | +""" |
| 106 | + |
| 107 | + |
| 108 | +myst_substitutions = { |
| 109 | + "pip_dependencies": "{{ extra_dependencies }}", |
| 110 | + "conda_dependencies": "{{ extra_dependencies }}", |
| 111 | + "extra_install_notes": "", |
| 112 | + "citation_code": citation_code, |
| 113 | +} |
| 114 | +nb_execution_mode = "off" |
| 115 | + |
| 116 | + |
| 117 | +remove_from_toctrees = [ |
| 118 | + "BART/*", |
| 119 | + "case_studies/*", |
| 120 | + "causal_inference/*", |
| 121 | + "diagnostics_and_criticism/*", |
| 122 | + "gaussian_processes/*", |
| 123 | + "generalized_linear_models/*", |
| 124 | + "mixture_models/*", |
| 125 | + "ode_models/*", |
| 126 | + "howto/*", |
| 127 | + "samplers/*", |
| 128 | + "splines/*", |
| 129 | + "survival_analysis/*", |
| 130 | + "time_series/*", |
| 131 | + "variational_inference/*", |
178 | 132 | ]
|
179 | 133 |
|
| 134 | +# bibtex config |
| 135 | +bibtex_bibfiles = ["references.bib"] |
| 136 | +bibtex_default_style = "unsrt" |
| 137 | +bibtex_reference_style = "author_year" |
180 | 138 |
|
181 |
| -# -- Options for Epub output ------------------------------------------------- |
182 |
| - |
183 |
| -# Bibliographic Dublin Core info. |
184 |
| -epub_title = project |
185 |
| - |
186 |
| -# The unique identifier of the text. This can be a ISBN number |
187 |
| -# or the project homepage. |
188 |
| -# |
189 |
| -# epub_identifier = '' |
190 |
| - |
191 |
| -# A unique identification for the text. |
192 |
| -# |
193 |
| -# epub_uid = '' |
194 |
| - |
195 |
| -# A list of files that should not be packed into the epub file. |
196 |
| -epub_exclude_files = ["search.html"] |
197 |
| - |
198 |
| - |
199 |
| -# -- Extension configuration ------------------------------------------------- |
200 |
| -# https://svn.python.org/projects/external/Jinja-1.1/docs/build/designerdoc.html |
| 139 | +# OpenGraph config |
| 140 | +# use default readthedocs integration aka no config here |
| 141 | + |
| 142 | +codeautolink_autodoc_inject = False |
| 143 | +codeautolink_concat_default = True |
| 144 | + |
| 145 | +# intersphinx mappings |
| 146 | +intersphinx_mapping = { |
| 147 | + "arviz": ("https://python.arviz.org/en/latest/", None), |
| 148 | + "bambi": ("https://bambinos.github.io/bambi", None), |
| 149 | + "einstats": ("https://einstats.python.arviz.org/en/latest/", None), |
| 150 | + "mpl": ("https://matplotlib.org/", None), |
| 151 | + "numpy": ("https://numpy.org/doc/stable/", None), |
| 152 | + "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), |
| 153 | + "pymc": ("https://www.pymc.io/projects/docs/en/stable/", None), |
| 154 | + "pytensor": ("https://pytensor.readthedocs.io/en/latest/", None), |
| 155 | + "pmx": ("https://www.pymc.io/projects/experimental/en/latest/", None), |
| 156 | + "scipy": ("https://docs.scipy.org/doc/scipy/reference/", None), |
| 157 | + "xarray": ("https://docs.xarray.dev/en/stable/", None), |
| 158 | +} |
0 commit comments