Skip to content

implement _display_ method for pm.Model for builtin marimo support #7830

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

Merged
merged 1 commit into from
Jun 24, 2025
Merged
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: 6 additions & 1 deletion pymc/model/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
from pymc.logprob.basic import transformed_conditional_logp
from pymc.logprob.transforms import Transform
from pymc.logprob.utils import ParameterValueError, replace_rvs_by_values
from pymc.model_graph import model_to_graphviz
from pymc.model_graph import model_to_graphviz, model_to_mermaid
from pymc.pytensorf import (
PointFunc,
SeedSequenceSeed,
Expand Down Expand Up @@ -437,6 +437,11 @@
"""Exit the context manager."""
_ = MODEL_MANAGER.active_contexts.pop()

def _display_(self):
import marimo as mo

Check warning on line 441 in pymc/model/core.py

View check run for this annotation

Codecov / codecov/patch

pymc/model/core.py#L441

Added line #L441 was not covered by tests

return mo.mermaid(model_to_mermaid(self))

Check warning on line 443 in pymc/model/core.py

View check run for this annotation

Codecov / codecov/patch

pymc/model/core.py#L443

Added line #L443 was not covered by tests

@staticmethod
def _validate_name(name):
if name.endswith(":"):
Expand Down