diff --git a/opvious/modeling/model.py b/opvious/modeling/model.py index eaa35f1..67fe6df 100644 --- a/opvious/modeling/model.py +++ b/opvious/modeling/model.py @@ -3,6 +3,7 @@ import collections import dataclasses import logging +import os import pandas as pd from typing import Any, Iterable, Literal, Mapping, Optional, Sequence, Union @@ -289,7 +290,9 @@ def definition_counts(self) -> pd.DataFrame: grouped: Any = df.groupby(["title", "category"])["text"].count() return grouped.unstack(["category"]).fillna(0).astype(int) - def specification(self, align=True) -> LocalSpecification: + def specification( + self, align: Optional[bool] = None + ) -> LocalSpecification: """Generates the model's specification This specification can be used to interact with :class:`.Client` @@ -300,6 +303,8 @@ def specification(self, align=True) -> LocalSpecification: environment. This can be disabled to enable pretty printing in environments which do not support them (e.g. Colab). """ + if align is None: + align = not os.getenv("COLAB_RELEASE_TAG") grouped = collections.defaultdict(list) for s in self.statements(): grouped[s.title].append(s.text) @@ -319,4 +324,4 @@ def specification(self, align=True) -> LocalSpecification: def _format_contents(contents, align): if align: return f"$$\n\\begin{{align*}}\n{contents}\\end{{align*}}\n$$" - return f"$$\n{contents.replace('&', '')}\n$$" + return f"$$\n{contents.replace('&', '')}$$" diff --git a/pyproject.toml b/pyproject.toml index f2e10d2..6cc13ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "opvious" -version = "0.18.7rc1" +version = "0.18.8rc1" description = "Opvious Python SDK" authors = ["Opvious Engineering "] readme = "README.md"