Skip to content

Commit 627e49d

Browse files
authored
Merge branch 'pymc-devs:main' into flaky_eulermaruyama_tests
2 parents f2a70fd + d4ff7ae commit 627e49d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+345
-1207
lines changed

conda-envs/environment-dev.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ dependencies:
2727
- myst-nb
2828
- numpydoc
2929
- pre-commit>=2.8.0
30-
- pydata-sphinx-theme>=0.11.0
3130
- pytest-cov>=2.5
3231
- pytest>=3.0
3332
- sphinx-copybutton
@@ -38,5 +37,7 @@ dependencies:
3837
- watermark
3938
- polyagamma
4039
- sphinx-remove-toctrees
41-
- mypy=0.982
40+
- mypy=0.990
4241
- types-cachetools
42+
- pip:
43+
- git+https://github.com/pymc-devs/pymc-sphinx-theme

conda-envs/environment-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ dependencies:
2727
- pre-commit>=2.8.0
2828
- pytest-cov>=2.5
2929
- pytest>=3.0
30-
- mypy=0.982
30+
- mypy=0.990
3131
- types-cachetools

conda-envs/windows-environment-dev.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ dependencies:
2525
- myst-nb
2626
- numpydoc
2727
- pre-commit>=2.8.0
28-
- pydata-sphinx-theme>=0.11.0
2928
- pytest-cov>=2.5
3029
- pytest>=3.0
3130
- sphinx-autobuild>=0.7
@@ -35,5 +34,7 @@ dependencies:
3534
- sphinx>=1.5
3635
- watermark
3736
- sphinx-remove-toctrees
38-
- mypy=0.982
37+
- mypy=0.990
3938
- types-cachetools
39+
- pip:
40+
- git+https://github.com/pymc-devs/pymc-sphinx-theme

conda-envs/windows-environment-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ dependencies:
2828
- pre-commit>=2.8.0
2929
- pytest-cov>=2.5
3030
- pytest>=3.0
31-
- mypy=0.982
31+
- mypy=0.990
3232
- types-cachetools

docs/source/_static/custom.css

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

docs/source/_templates/donate.html

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

docs/source/_templates/edit-this-page.html

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

docs/source/_templates/footer.html

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

docs/source/_templates/layout.html

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

docs/source/_templates/navbar-version.html

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

docs/source/_templates/search-field.html

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

docs/source/_templates/twitter.html

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

docs/source/conf.py

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
# serve to show the default.
1818

1919
import os
20-
import sys
2120
from pathlib import Path
2221

2322
import pymc # isort:skip
@@ -110,8 +109,12 @@
110109
version = pymc.__version__
111110
if os.environ.get("READTHEDOCS", False):
112111
rtd_version = os.environ.get("READTHEDOCS_VERSION", "")
113-
if "." not in rtd_version and rtd_version.lower() != "stable":
112+
if rtd_version.lower() == "stable":
113+
version = pymc.__version__.split("+")[0]
114+
elif rtd_version.lower() == "latest":
114115
version = "dev"
116+
else:
117+
version = rtd_version
115118
else:
116119
rtd_version = "local"
117120
# The full version, including alpha/beta/rc tags.
@@ -222,47 +225,17 @@ def setup(app):
222225

223226
# The theme to use for HTML and HTML Help pages. See the documentation for
224227
# a list of builtin themes.
225-
html_theme = "pydata_sphinx_theme"
228+
html_theme = "pymc_sphinx_theme"
226229

227230

228231
# Theme options are theme-specific and customize the look and feel of a theme
229232
# further. For a list of options available for each theme, see the
230233
# documentation.
231234

232235
html_theme_options = {
233-
"icon_links": [
234-
{
235-
"name": "GitHub",
236-
"url": "https://github.com/pymc-devs/pymc",
237-
"icon": "fab fa-github-square",
238-
},
239-
{
240-
"name": "Twitter",
241-
"url": "https://twitter.com/pymc_devs",
242-
"icon": "fab fa-twitter-square",
243-
},
244-
{
245-
"name": "YouTube",
246-
"url": "https://www.youtube.com/c/PyMCDevelopers",
247-
"icon": "fab fa-youtube",
248-
},
249-
{
250-
"name": "Discourse",
251-
"url": "https://discourse.pymc.io",
252-
"icon": "fab fa-discourse",
253-
},
254-
],
255236
"logo": {
256237
"link": "https://www.pymc.io",
257238
},
258-
"show_prev_next": False,
259-
"navbar_start": ["navbar-logo", "navbar-version"],
260-
"navbar_end": ["navbar-icon-links.html"],
261-
"page_sidebar_items": ["page-toc", "edit-this-page", "donate"],
262-
"header_links_before_dropdown": 6,
263-
"search_bar_text": "Search...",
264-
"use_edit_page_button": True,
265-
"google_analytics_id": "UA-176578023-1",
266239
}
267240
html_context = {
268241
"github_user": "pymc-devs",
@@ -294,8 +267,7 @@ def setup(app):
294267
# Add any paths that contain custom static files (such as style sheets) here,
295268
# relative to this directory. They are copied after the builtin static files,
296269
# so a file named "default.css" will overwrite the builtin "default.css".
297-
html_static_path = ["../logos", "_static"]
298-
html_css_files = ["custom.css"]
270+
html_static_path = ["../logos"]
299271

300272
# Add any extra paths that contain custom files (such as robots.txt or
301273
# .htaccess) here, relative to this directory. These files are copied
@@ -311,9 +283,6 @@ def setup(app):
311283
# html_use_smartypants = True
312284

313285
# Custom sidebar templates, maps document names to template names.
314-
html_sidebars = {
315-
"**": ["sidebar-nav-bs.html"],
316-
}
317286

318287
# Additional templates that should be rendered to pages, maps page names to
319288
# template names.

pymc/backends/arviz.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,11 @@
2626
import pymc
2727

2828
from pymc.aesaraf import extract_obs_data
29-
from pymc.model import modelcontext
29+
from pymc.model import Model, modelcontext
3030
from pymc.util import get_default_varnames
3131

3232
if TYPE_CHECKING:
33-
from typing import Set # pylint: disable=ungrouped-imports
34-
3533
from pymc.backends.base import MultiTrace # pylint: disable=invalid-name
36-
from pymc.model import Model
3734

3835
___all__ = [""]
3936

@@ -145,12 +142,10 @@ def insert(self, k: str, v, idx: int):
145142
class InferenceDataConverter: # pylint: disable=too-many-instance-attributes
146143
"""Encapsulate InferenceData specific logic."""
147144

148-
model = None # type: Optional[Model]
149-
nchains = None # type: int
150-
ndraws = None # type: int
151-
posterior_predictive = None # Type: Optional[Mapping[str, np.ndarray]]
152-
predictions = None # Type: Optional[Mapping[str, np.ndarray]]
153-
prior = None # Type: Optional[Mapping[str, np.ndarray]]
145+
model: Optional[Model] = None
146+
posterior_predictive: Optional[Mapping[str, np.ndarray]] = None
147+
predictions: Optional[Mapping[str, np.ndarray]] = None
148+
prior: Optional[Mapping[str, np.ndarray]] = None
154149

155150
def __init__(
156151
self,

pymc/backends/ndarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def setup(self, draws, chain, sampler_vars=None) -> None:
8585
if self._stats is None:
8686
self._stats = []
8787
for sampler in sampler_vars:
88-
data = dict() # type: Dict[str, np.ndarray]
88+
data: Dict[str, np.ndarray] = dict()
8989
self._stats.append(data)
9090
for varname, dtype in sampler.items():
9191
data[varname] = np.zeros(draws, dtype=dtype)

pymc/backends/report.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import dataclasses
1616
import logging
1717

18-
from typing import Optional
18+
from typing import Dict, List, Optional
1919

2020
import arviz
2121

@@ -32,7 +32,7 @@
3232
class SamplerReport:
3333
"""Bundle warnings, convergence stats and metadata of a sampling run."""
3434

35-
def __init__(self):
35+
def __init__(self) -> None:
3636
self._chain_warnings: Dict[int, List[SamplerWarning]] = {}
3737
self._global_warnings: List[SamplerWarning] = []
3838
self._n_tune = None

pymc/blocking.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
1818
Classes for working with subsets of parameters.
1919
"""
20-
import collections
20+
from __future__ import annotations
2121

2222
from functools import partial
23-
from typing import Callable, Dict, Generic, Optional, TypeVar
23+
from typing import Callable, Dict, Generic, NamedTuple, TypeVar
2424

2525
import numpy as np
2626

@@ -32,7 +32,9 @@
3232

3333
# `point_map_info` is a tuple of tuples containing `(name, shape, dtype)` for
3434
# each of the raveled variables.
35-
RaveledVars = collections.namedtuple("RaveledVars", "data, point_map_info")
35+
class RaveledVars(NamedTuple):
36+
data: np.ndarray
37+
point_map_info: tuple[tuple[str, tuple[int, ...], np.dtype], ...]
3638

3739

3840
class Compose(Generic[T]):
@@ -69,7 +71,7 @@ def map(var_dict: PointType) -> RaveledVars:
6971
@staticmethod
7072
def rmap(
7173
array: RaveledVars,
72-
start_point: Optional[PointType] = None,
74+
start_point: PointType | None = None,
7375
) -> PointType:
7476
"""Map 1D concatenated array to a dictionary of variables in their original spaces.
7577
@@ -100,7 +102,7 @@ def rmap(
100102

101103
@classmethod
102104
def mapf(
103-
cls, f: Callable[[PointType], T], start_point: Optional[PointType] = None
105+
cls, f: Callable[[PointType], T], start_point: PointType | None = None
104106
) -> Callable[[RaveledVars], T]:
105107
"""Create a callable that first maps back to ``dict`` inputs and then applies a function.
106108

pymc/data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ class Minibatch(TensorVariable):
301301
>>> assert x.eval().shape == (2, 20, 20, 40, 10)
302302
"""
303303

304-
RNG = collections.defaultdict(list) # type: Dict[str, List[Any]]
304+
RNG: Dict[str, List[Any]] = collections.defaultdict(list)
305305

306306
@aesara.config.change_flags(compute_test_value="raise")
307307
def __init__(
@@ -708,7 +708,7 @@ def Data(
708708
xshape = x.shape
709709
# Register new dimension lengths
710710
for d, dname in enumerate(dims):
711-
if not dname in model.dim_lengths:
711+
if dname not in model.dim_lengths:
712712
model.add_coord(
713713
name=dname,
714714
# Note: Coordinate values can't be taken from

0 commit comments

Comments
 (0)