From d9e0bbd75a3cb4c1ab16708d2e6b95bc8444699b Mon Sep 17 00:00:00 2001 From: Callum J Hays Date: Fri, 7 Oct 2022 07:42:16 +1000 Subject: [PATCH] BREAKING CHANGE: Solution.print() and tabulate() have been removed --- mathpad/display.py | 20 -------------------- mathpad/solve.py | 13 ++----------- pyproject.toml | 7 +++++-- 3 files changed, 7 insertions(+), 33 deletions(-) delete mode 100644 mathpad/display.py diff --git a/mathpad/display.py b/mathpad/display.py deleted file mode 100644 index 9a8aec0..0000000 --- a/mathpad/display.py +++ /dev/null @@ -1,20 +0,0 @@ -from typing import Union -from ansitable import ANSITable -from mathpad.val import Val -from mathpad.equation import Equation - - -def tabulate(*entities: Union[Val, Equation]): - "Prints a list of values or relations consistent with the display environment" - - # TODO: latex version in supporting IPython environments - table = ANSITable(" Entity ", " Units ", border="thick", bordercolor="blue") - - for entity in entities: - if isinstance(entity, Val): - table.row(entity.val, entity.units) - - else: - table.row(f"{entity.lhs} == {entity.rhs}", entity.units) - - table.print() \ No newline at end of file diff --git a/mathpad/solve.py b/mathpad/solve.py index 0747f16..1df9f67 100644 --- a/mathpad/solve.py +++ b/mathpad/solve.py @@ -1,5 +1,4 @@ -from typing import Collection, Dict, Set, Tuple, Union, overload -from ansitable import ANSITable +from typing import Collection, Dict, Union, overload import sympy from mathpad.val import Val, ValT @@ -13,7 +12,7 @@ def __init__(self, result_dict: Dict[Val, Val]): def __getitem__(self, k: ValT) -> ValT: result = self.result_dict[k] assert result.units == k.units - return result + return result # type: ignore def __repr__(self): return self._repr("", " ") @@ -28,14 +27,6 @@ def _repr(self, newline: str, indent: str): + f"{newline}{' ' if not newline else ''})" ) - def print(self): - table = ANSITable( - " unknown ", " solutions ", border="thick", bordercolor="green" - ) - for k, v in self.result_dict.items(): - table.row(k, v) - table.print() - @overload def solve(equations: Equation, solve_for: Val, in_place: bool = False) -> Solution: diff --git a/pyproject.toml b/pyproject.toml index ca9c564..1eaa614 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,10 +28,13 @@ typing-extensions = "^4.0.0" numpy = "^1.20" sympy = "^1.8" tqdm = "^4.62.3" -ansitable = "^0.9.6" scipy = "^1.7.1" plotly = "^5.3.1" -kaleido = "0.2.1" + + +[tool.poetry.extras] +# kaleido doesn't work on jupyterlite yet +static_plots = ["kaleido==0.2.1"] [build-system]