python-color-math 0.2.15__tar.gz → 0.2.17__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_color_math-0.2.15/python_color_math.egg-info → python_color_math-0.2.17}/PKG-INFO +1 -1
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/__init__.py +1 -1
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/ipython.py +57 -2
- {python_color_math-0.2.15 → python_color_math-0.2.17}/pyproject.toml +1 -1
- {python_color_math-0.2.15 → python_color_math-0.2.17/python_color_math.egg-info}/PKG-INFO +1 -1
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_ipython.py +4 -2
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_mcp_hardcore.py +3 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_mcp_server.py +3 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/.pre-commit-hooks.yaml +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/LICENSE +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/MANIFEST.in +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/README.md +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/__main__.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/adapters.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/colormath.default.json +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/completions.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/config.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/converters/__init__.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/converters/align.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/converters/block.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/converters/derivative.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/converters/equation.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/converters/generic.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/converters/integral.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/converters/limit.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/converters/matrix.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/converters/semantic.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/converters/unicode_converter.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/custom_definitions.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/gui.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/io.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/jupyter.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/main.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/mcp.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/mcp_server.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/__init__.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/alignment.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/braket.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/constants.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/delimiters.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/differentials.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/dimensionless.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/frontmatter.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/latex_spans.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/markdown_scanner.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/math_parser.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/physics.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/scanner.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/taxonomy.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/units.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/variable_hash.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/py.typed +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/self_test.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/tutorial.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/undo.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/unicode.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/utils/__init__.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/utils/coloring.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/utils/latex_helpers.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/utils/spans.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/python_color_math/__init__.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/python_color_math/__main__.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/python_color_math.egg-info/SOURCES.txt +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/python_color_math.egg-info/dependency_links.txt +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/python_color_math.egg-info/entry_points.txt +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/python_color_math.egg-info/requires.txt +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/python_color_math.egg-info/top_level.txt +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/setup.cfg +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_adversarial.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_cli.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_config_tolerance.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_custom_definitions.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_extreme_adversarial.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_features.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_frontmatter.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_fuzz.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_gui.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_physics.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_unicode.py +0 -0
- {python_color_math-0.2.15 → python_color_math-0.2.17}/tests/test_unicode_converter.py +0 -0
|
@@ -7,10 +7,17 @@ Notebook, and Google Colab via `%load_ext color_math`.
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
9
|
import shlex
|
|
10
|
+
from pathlib import Path
|
|
10
11
|
from typing import Any
|
|
11
12
|
|
|
12
13
|
from .adapters import transform_document
|
|
13
|
-
from .config import
|
|
14
|
+
from .config import (
|
|
15
|
+
ColorMathOptions,
|
|
16
|
+
THEMES,
|
|
17
|
+
load_config,
|
|
18
|
+
get_global_config_path,
|
|
19
|
+
save_default_config,
|
|
20
|
+
)
|
|
14
21
|
from .converters.block import convert_math_block, convert_text
|
|
15
22
|
|
|
16
23
|
try:
|
|
@@ -69,7 +76,12 @@ if HAS_IPYTHON:
|
|
|
69
76
|
super().__init__(shell)
|
|
70
77
|
self._auto_hook_active = False
|
|
71
78
|
self._orig_math_repr = None
|
|
72
|
-
|
|
79
|
+
palette, options, _ = load_config()
|
|
80
|
+
local_or_global = Path(".colormath.json").exists() or bool(
|
|
81
|
+
get_global_config_path() and get_global_config_path().exists()
|
|
82
|
+
)
|
|
83
|
+
self._palette = palette
|
|
84
|
+
self._options = options if local_or_global else ColorMathOptions.extended()
|
|
73
85
|
|
|
74
86
|
def _parse_magic_args(self, arg_str: str) -> tuple[str | None, ColorMathOptions, str]:
|
|
75
87
|
"""Parse leading flags (--theme, -v, --variables) without corrupting LaTeX backslashes."""
|
|
@@ -164,6 +176,38 @@ if HAS_IPYTHON:
|
|
|
164
176
|
status = "ENABLED" if self._options.variable_data_flow else "DISABLED"
|
|
165
177
|
print(f"Color Math: Variable data-flow coloring is currently {status}.")
|
|
166
178
|
|
|
179
|
+
@line_magic("color_math_config")
|
|
180
|
+
def color_math_config(self, line: str) -> None:
|
|
181
|
+
"""Inspect or initialize Color Math configuration.
|
|
182
|
+
|
|
183
|
+
Usage:
|
|
184
|
+
%color_math_config
|
|
185
|
+
%color_math_config --init
|
|
186
|
+
%color_math_config --reload
|
|
187
|
+
"""
|
|
188
|
+
raw = line.strip().lower()
|
|
189
|
+
if "--init" in raw:
|
|
190
|
+
target = Path(".colormath.json")
|
|
191
|
+
save_default_config(target)
|
|
192
|
+
print(f"Color Math: Created config template at '{target.resolve()}'.")
|
|
193
|
+
self._palette, self._options, _ = load_config(target)
|
|
194
|
+
return
|
|
195
|
+
if "--reload" in raw:
|
|
196
|
+
self._palette, self._options, _ = load_config()
|
|
197
|
+
print("Color Math: Configuration reloaded.")
|
|
198
|
+
return
|
|
199
|
+
|
|
200
|
+
local_path = Path(".colormath.json")
|
|
201
|
+
global_path = get_global_config_path()
|
|
202
|
+
print("Color Math Configuration:")
|
|
203
|
+
print(f" Local config: {local_path.resolve()} ({'exists' if local_path.exists() else 'not found'})")
|
|
204
|
+
if global_path:
|
|
205
|
+
print(f" Global config: {global_path} ({'exists' if global_path.exists() else 'not found'})")
|
|
206
|
+
print(f" Variables: {'ENABLED' if self._options.variable_data_flow else 'DISABLED'}")
|
|
207
|
+
print(f" Taxonomy: {'ENABLED' if self._options.enable_taxonomy else 'DISABLED'}")
|
|
208
|
+
print(f" Delimiters: {'ENABLED' if self._options.rainbow_delimiters else 'DISABLED'}")
|
|
209
|
+
print(f" Auto-display: {'ENABLED' if self._auto_hook_active else 'DISABLED'}")
|
|
210
|
+
|
|
167
211
|
@line_magic("color_math_auto")
|
|
168
212
|
def color_math_auto(self, line: str) -> None:
|
|
169
213
|
"""Toggle automatic semantic colorization for all IPython.display.Math outputs.
|
|
@@ -213,6 +257,17 @@ if HAS_IPYTHON:
|
|
|
213
257
|
if self._orig_math_repr is not None:
|
|
214
258
|
Math._repr_latex_ = self._orig_math_repr # type: ignore[assignment]
|
|
215
259
|
self._auto_hook_active = False
|
|
260
|
+
else:
|
|
261
|
+
class ColorMath: # type: ignore[no-redef]
|
|
262
|
+
"""Fallback when IPython is not installed."""
|
|
263
|
+
|
|
264
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
265
|
+
raise ImportError(
|
|
266
|
+
"IPython is required to use ColorMath. Install it with 'pip install ipython' or 'pip install python-color-math[jupyter]'."
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
class ColorMathMagics: # type: ignore[no-redef]
|
|
270
|
+
pass
|
|
216
271
|
|
|
217
272
|
|
|
218
273
|
def load_ipython_extension(ipython: Any) -> None:
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python-color-math"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.17"
|
|
8
8
|
description = "A fast, local semantic LaTeX colorizer for Markdown, Jupyter, and LaTeX math equations."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/converters/unicode_converter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_color_math-0.2.15 → python_color_math-0.2.17}/color_math/parsers/markdown_scanner.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_color_math-0.2.15 → python_color_math-0.2.17}/python_color_math.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{python_color_math-0.2.15 → python_color_math-0.2.17}/python_color_math.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{python_color_math-0.2.15 → python_color_math-0.2.17}/python_color_math.egg-info/requires.txt
RENAMED
|
File without changes
|
{python_color_math-0.2.15 → python_color_math-0.2.17}/python_color_math.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|