Skip to content

Commit c9f6af3

Browse files
committed
Update docs to use pymc(pydata) theme
1 parent 8e097c0 commit c9f6af3

File tree

10 files changed

+65
-176
lines changed

10 files changed

+65
-176
lines changed

doc/.build/PLACEHOLDER

Lines changed: 0 additions & 1 deletion
This file was deleted.

doc/.static/PLACEHOLDER

Lines changed: 0 additions & 1 deletion
This file was deleted.

doc/.static/fix_rtd.css

Lines changed: 0 additions & 11 deletions
This file was deleted.

doc/.static/version_switch.js

Lines changed: 0 additions & 101 deletions
This file was deleted.

doc/conf.py

Lines changed: 29 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,9 @@
1818
# absolute, like shown here.
1919
# sys.path.append(os.path.abspath('some/directory'))
2020

21-
2221
import os
23-
import sys
2422
import pytensor
2523

26-
pytensor_path = os.path.join(os.path.dirname(__file__), os.pardir)
27-
sys.path.append(os.path.abspath(pytensor_path))
28-
import versioneer
29-
3024
# General configuration
3125
# ---------------------
3226

@@ -38,27 +32,15 @@
3832
"sphinx.ext.doctest",
3933
"sphinx.ext.napoleon",
4034
"sphinx.ext.linkcode",
35+
"sphinx.ext.mathjax",
4136
]
4237

38+
needs_sphinx = "3"
39+
4340
todo_include_todos = True
4441
napoleon_google_docstring = False
4542
napoleon_include_special_with_doc = False
4643

47-
# We do it like this to support multiple sphinx version without having warning.
48-
# Our buildbot consider warning as error.
49-
try:
50-
from sphinx.ext import imgmath
51-
52-
extensions.append("sphinx.ext.imgmath")
53-
except ImportError:
54-
try:
55-
from sphinx.ext import pngmath
56-
57-
extensions.append("sphinx.ext.pngmath")
58-
except ImportError:
59-
pass
60-
61-
6244
# Add any paths that contain templates here, relative to this directory.
6345
templates_path = [".templates"]
6446

@@ -70,22 +52,25 @@
7052

7153
# General substitutions.
7254
project = "PyTensor"
73-
copyright = "PyTensor Developers, 2021; PyMC Developers, 2020-2021; 2008--2019, LISA lab"
55+
copyright = "PyMC Team 2022-present,2020-2021; Aesara Developers, 2021-2022; LISA Lab, 2008--2019"
7456

7557
# The default replacements for |version| and |release|, also used in various
7658
# other places throughout the built documents.
7759
#
7860

79-
# We need this hokey-pokey because versioneer needs the current
80-
# directory to be the root of the project to work.
81-
_curpath = os.getcwd()
82-
os.chdir(os.path.dirname(os.path.dirname(__file__)))
61+
version = pytensor.__version__
62+
if os.environ.get("READTHEDOCS", False):
63+
rtd_version = os.environ.get("READTHEDOCS_VERSION", "")
64+
if rtd_version.lower() == "stable":
65+
version = pymc.__version__.split("+")[0]
66+
elif rtd_version.lower() == "latest":
67+
version = "dev"
68+
else:
69+
version = rtd_version
70+
else:
71+
rtd_version = "local"
8372
# The full version, including alpha/beta/rc tags.
84-
release = versioneer.get_version()
85-
# The short X.Y version.
86-
version = ".".join(release.split(".")[:2])
87-
os.chdir(_curpath)
88-
del _curpath
73+
release = version
8974

9075
# There are two options for replacing |today|: either, you set today to some
9176
# non-false value, then it is used:
@@ -132,19 +117,18 @@
132117
# https://github.com/readthedocs/sphinx_rtd_theme/issues/766#issuecomment-513852197
133118
html4_writer = True
134119

135-
# Read the docs style:
136-
if os.environ.get("READTHEDOCS") != "True":
137-
try:
138-
import sphinx_rtd_theme
139-
except ImportError:
140-
pass # assume we have sphinx >= 1.3
141-
else:
142-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
143-
html_theme = "sphinx_rtd_theme"
144-
145-
146-
def setup(app):
147-
app.add_css_file("fix_rtd.css")
120+
html_logo = "images/pytensor_logo.svg"
121+
html_theme = "pymc_sphinx_theme"
122+
html_theme_options = {
123+
"use_search_override": False,
124+
}
125+
html_context = {
126+
"github_user": "pymc-devs",
127+
"github_repo": "pytensor",
128+
"github_version": "main",
129+
"doc_path": "doc",
130+
"default_mode": "light",
131+
}
148132

149133

150134
# The name for this set of Sphinx documents. If None, it defaults to
@@ -166,7 +150,7 @@ def setup(app):
166150
# Add any paths that contain custom static files (such as style sheets) here,
167151
# relative to this directory. They are copied after the builtin static files,
168152
# so a file named "default.css" will overwrite the builtin "default.css".
169-
html_static_path = [".static", "images", "library/d3viz/examples"]
153+
html_static_path = ["images", "library/d3viz/examples"]
170154

171155
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
172156
# using the given strftime format.

doc/dev_start_guide.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
Developer Start Guide
55
=====================
66

7+
.. toctree::
8+
:hidden:
9+
10+
self
11+
internal/index
12+
713
Contributing
814
============
915

doc/environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ dependencies:
1010
- scipy
1111
- six
1212
- sphinx>=3
13-
- sphinx_rtd_theme
1413
- mock
1514
- pillow
1615
- pip
1716
- pip:
18-
- -e ..[doc]
17+
- git+https://github.com/pymc-devs/pymc-sphinx-theme
18+
- -e ..

doc/index.rst

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,9 @@ Community
7878
:hidden:
7979

8080
introduction
81-
install
82-
tutorial/index
83-
extending/index
84-
dev_start_guide
85-
optimizations
86-
library/index
87-
troubleshooting
88-
glossary
89-
links
90-
internal/index
91-
acknowledgement
92-
81+
user_guide
82+
API <library/index>
83+
Contributing <dev_start_guide>
9384

9485
.. _Theano: https://github.com/Theano/Theano
9586
.. _pytensor-users: https://gitter.im/pymc-devs/pytensor

doc/introduction.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
.. _introduction:
33

4-
====================
5-
PyTensor at a Glance
6-
====================
4+
===============
5+
Getting Started
6+
===============
77

88
PyTensor is a Python library that allows one to define, optimize/rewrite, and
99
evaluate mathematical expressions, especially ones involving multi-dimensional
@@ -150,6 +150,12 @@ pytensor-dev_
150150
We welcome all kinds of contributions. If you have any questions regarding how
151151
to extend PyTensor, please feel free to ask.
152152

153+
.. toctree::
154+
:hidden:
155+
156+
self
157+
install
158+
tutorial/index
153159

154160
.. _LISA: https://mila.umontreal.ca/
155161
.. _Greek mathematician: http://en.wikipedia.org/wiki/Theano_(mathematician)

doc/user_guide.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
.. _user_guide:
3+
4+
==========
5+
User Guide
6+
==========
7+
8+
.. toctree::
9+
:maxdepth: 1
10+
11+
extending/index
12+
optimizations
13+
troubleshooting
14+
glossary
15+
links
16+
acknowledgement

0 commit comments

Comments
 (0)