Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several API doc improvements #5367

Merged
merged 5 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ This includes API changes we did not warn about since at least `3.11.0` (2021-01
- Nested models now inherit the parent model's coordinates. [#5344](https://github.com/pymc-devs/pymc/pull/5344)
- ...

## Documentation
- Switched to the [pydata-sphinx-theme](https://pydata-sphinx-theme.readthedocs.io/en/latest/)
- Updated our documentation tooling to use [MyST](https://myst-parser.readthedocs.io/en/latest/), [MyST-NB](https://myst-nb.readthedocs.io/en/latest/), sphinx-design, notfound.extension,
sphinx-copybutton and sphinx-remove-toctrees.
- Separated the builds of the example notebooks and of the versioned docs.
- Restructured the documentation to facilitate learning paths
- Updated API docs to document objects at the path users should use to import them

### Internal changes
- ⚠ PyMC now requires Scipy version `>= 1.4.1` (see [4857](https://github.com/pymc-devs/pymc/pull/4857)).
Expand Down
1 change: 1 addition & 0 deletions conda-envs/environment-dev-py37.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ dependencies:
- typing-extensions
- pip:
- sphinx-design
- sphinx-remove-toctrees
1 change: 1 addition & 0 deletions conda-envs/environment-dev-py38.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ dependencies:
- typing-extensions>=3.7.4
- pip:
- sphinx-design
- sphinx-remove-toctrees
1 change: 1 addition & 0 deletions conda-envs/environment-dev-py39.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ dependencies:
- typing-extensions>=3.7.4
- pip:
- sphinx-design
- sphinx-remove-toctrees
1 change: 1 addition & 0 deletions conda-envs/windows-environment-dev-py38.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ dependencies:
- watermark
- pip:
- sphinx-design
- sphinx-remove-toctrees
30 changes: 30 additions & 0 deletions docs/source/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}

{% block methods %}
{% if methods %}

.. rubric:: Methods

.. autosummary::
:toctree: classmethods

{% for item in methods %}
{{ objname }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: Attributes

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
6 changes: 3 additions & 3 deletions docs/source/api/gp.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gaussian Processes API
----------------------
Gaussian Processes
------------------

.. currentmodule:: pymc.gp.gp
.. automodule:: pymc.gp

.. toctree::

Expand Down
37 changes: 18 additions & 19 deletions docs/source/api/gp/cov.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@
Covariance Functions
********************

.. currentmodule:: pymc.gp.cov
.. automodule:: pymc.gp.cov
.. autosummary::
Constant
WhiteNoise
ExpQuad
RatQuad
Exponential
Matern52
Matern32
Linear
Polynomial
Cosine
Periodic
WarpedInput
Gibbs
Coregion
ScaledCov
Kron
:toctree: generated

.. automodule:: pymc.gp.cov
:members:
Constant
WhiteNoise
ExpQuad
RatQuad
Exponential
Matern52
Matern32
Linear
Polynomial
Cosine
Periodic
WarpedInput
Gibbs
Coregion
ScaledCov
Kron
11 changes: 5 additions & 6 deletions docs/source/api/gp/implementations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
Implementations
***************

.. currentmodule:: pymc.gp.gp
.. currentmodule:: pymc.gp
.. autosummary::
:toctree: generated

Latent
Marginal
LatentKron
Marginal
MarginalKron
MarginalSparse
MarginalApprox
TP

.. automodule:: pymc.gp.gp
:members:
6 changes: 2 additions & 4 deletions docs/source/api/gp/mean.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
Mean Functions
**************

.. currentmodule:: pymc.gp.mean
.. automodule:: pymc.gp.mean
.. autosummary::
:toctree: generated

Zero
Constant
Linear

.. automodule:: pymc.gp.mean
:members:
27 changes: 22 additions & 5 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,32 @@
"sphinx_design",
"notfound.extension",
"sphinx_copybutton",
"sphinx_remove_toctrees",
]

# Don't auto-generate summary for class members.
numpydoc_show_class_members = False
autosummary_generate = True
autodoc_typehints = "none"
remove_from_toctrees = ["**/classmethods/*"]

numpydoc_xref_param_type = True
# fmt: off
numpydoc_xref_ignore = {
"of", "or", "optional", "default", "numeric", "type", "scalar", "1D", "2D", "3D", "nD", "array",
"instance"
}
# fmt: on
numpydoc_xref_aliases = {
"TensorVariable": ":class:`~aesara.tensor.TensorVariable`",
"RandomVariable": ":class:`~aesara.tensor.random.RandomVariable`",
"ndarray": ":class:`~numpy.ndarray`",
"Covariance": ":mod:`Covariance <pymc.gp.cov>`",
"Mean": ":mod:`Mean <pymc.gp.mean>`",
}

# Show the documentation of __init__ and the class docstring
autoclass_content = "both"

# Do not show the return type as seperate section
napoleon_use_rtype = False
# autoclass_content = "both"

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
Expand Down Expand Up @@ -162,6 +178,7 @@
"nb": ("https://pymc-examples.readthedocs.io/en/latest/", None),
"myst": ("https://myst-parser.readthedocs.io/en/latest", None),
"myst-nb": ("https://myst-nb.readthedocs.io/en/latest/", None),
"python": ("https://docs.python.org/3/", None),
}


Expand Down Expand Up @@ -195,7 +212,7 @@
},
],
"show_prev_next": False,
"navbar_align": "content",
"navbar_align": "left",
"navbar_start": ["navbar-logo", "navbar-version"],
"navbar_end": ["search-field.html", "navbar-icon-links.html"],
"search_bar_text": "Search...",
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ See [Google Scholar](https://scholar.google.de/scholar?oi=bibs&hl=en&authuser=1&

installation
learning
Examples <https://docs.pymc.io/projects/examples/en/latest/>
api
community
contributing/index
Expand Down
15 changes: 10 additions & 5 deletions pymc/distributions/continuous.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ class Uniform(BoundedContinuous):
f(x \mid lower, upper) = \frac{1}{upper-lower}

.. plot::
:context: close-figs

import matplotlib.pyplot as plt
import numpy as np
Expand All @@ -289,10 +290,10 @@ class Uniform(BoundedContinuous):

Parameters
----------
lower: float
Lower limit.
upper: float
Upper limit.
lower : float, optional
Lower limit. Defaults to 0.
upper : float, optional
Upper limit. Defaults to 1.
"""
rv_op = uniform
bound_args_indices = (3, 4) # Lower, Upper
Expand All @@ -317,9 +318,13 @@ def logcdf(value, lower, upper):

Parameters
----------
value: numeric or np.ndarray or `TensorVariable`
value : numeric or ndarray or TensorVariable
Value(s) for which log CDF is calculated. If the log CDF for multiple
values are desired the values must be provided in a numpy array or `TensorVariable`.
lower : float, optional
Lower limit. Defaults to 0.
upper : float, optional
Upper limit. Defaults to 1.

Returns
-------
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ scipy>1.4.1
sphinx-copybutton
sphinx-design
sphinx-notfound-page
sphinx-remove-toctrees
sphinx>=1.5
typing-extensions>=3.7.4