Skip to content
Open
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
12 changes: 12 additions & 0 deletions pymc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def __set_compiler_flags():
from pymc.model.core import *
from pymc.model.transform.conditioning import do, observe
from pymc.model_graph import model_to_graphviz, model_to_networkx
from pymc.plots import DEPRECATED_PLOTS_ALIASES
from pymc.pytensorf import *
from pymc.sampling import *
from pymc.smc import *
Expand All @@ -62,3 +63,14 @@ def __set_compiler_flags():
from pymc.variational import *

__version__ = _version.get_versions()["version"]


def __getattr__(name):
if name in DEPRECATED_PLOTS_ALIASES:
new_name = DEPRECATED_PLOTS_ALIASES[name]
raise ImportError(
f"The function `{name}` from PyMC was an alias for `{new_name}` from "
f"ArviZ. It was removed in PyMC 4.0. "
f"Switch to `pymc.{new_name}` or `arviz.{new_name}`."
)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
22 changes: 22 additions & 0 deletions pymc/plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,25 @@
obj = getattr(az.plots, attr)
if not attr.startswith("__"):
setattr(sys.modules[__name__], attr, obj)

DEPRECATED_PLOTS_ALIASES = dict(
autocorrplot="plot_autocorr",
forestplot="plot_forest",
kdeplot="plot_kde",
energyplot="plot_energy",
densityplot="plot_density",
pairplot="plot_pair",
traceplot="plot_trace",
compareplot="plot_compare",
)


def __getattr__(name):
if name in DEPRECATED_PLOTS_ALIASES:
new_name = DEPRECATED_PLOTS_ALIASES[name]
raise ImportError(
f"The function `{name}` from PyMC was an alias for `{new_name}` from "
f"ArviZ. It was removed in PyMC 4.0. "
f"Switch to `pymc.{new_name}` or `arviz.{new_name}`."
)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")