mayutils 1.2.37__tar.gz → 1.2.38__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.
- {mayutils-1.2.37 → mayutils-1.2.38}/PKG-INFO +3 -1
- {mayutils-1.2.37 → mayutils-1.2.38}/pyproject.toml +3 -1
- mayutils-1.2.38/src/mayutils/export/html.py +63 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/visualisation/graphs/plotly/charts.py +42 -21
- {mayutils-1.2.37 → mayutils-1.2.38}/LICENSE +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/README.md +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/core/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/core/constants.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/data/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/data/analysis/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/data/cache/.gitkeep +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/data/live.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/data/local.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/data/queries/.gitkeep +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/data/queries/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/data/queries/examples/.gitkeep +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/data/read.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/environment/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/environment/benchmarking.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/environment/databases.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/environment/filesystem.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/environment/logging.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/environment/memoisation.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/environment/oauth.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/environment/secrets.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/environment/webdrivers.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/export/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/export/images.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/export/pdf.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/export/slides.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/interfaces/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/interfaces/google.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/interfaces/microsoft.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/interfaces/streamlit.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/mathematics/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/mathematics/numba.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/mathematics/numpy.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/objects/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/objects/classes.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/objects/colours.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/objects/dataframes.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/objects/datetime.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/objects/decorators.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/objects/dictionaries.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/objects/functions.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/objects/hashing.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/objects/numbers.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/objects/strings.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/objects/types.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/py.typed +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/scripts/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/scripts/clear_cache.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/scripts/versioning.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/testing/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/visualisation/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/visualisation/console.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/visualisation/graphs/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/visualisation/graphs/combine.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/visualisation/graphs/matplotlib/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/visualisation/graphs/matplotlib/template.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/visualisation/graphs/plotly/__init__.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/visualisation/graphs/plotly/templates.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/visualisation/graphs/plotly/traces.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/visualisation/graphs/plotly/utilities.py +0 -0
- {mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/visualisation/notebook.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: mayutils
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.38
|
|
4
4
|
Summary: Utilities for Python from Mayuran Visakan
|
|
5
5
|
Author: Mayuran Visakan
|
|
6
6
|
Author-email: Mayuran Visakan <mayuran.k.v@gmail.com>
|
|
@@ -43,6 +43,7 @@ Requires-Dist: jupysql>=0.11.1
|
|
|
43
43
|
Requires-Dist: jupyter>=1.1.1
|
|
44
44
|
Requires-Dist: kaleido>=1.0.0
|
|
45
45
|
Requires-Dist: keyring>=25.6.0
|
|
46
|
+
Requires-Dist: markdown
|
|
46
47
|
Requires-Dist: matplotlib>=3.10.5
|
|
47
48
|
Requires-Dist: modin[all]>=0.35.0
|
|
48
49
|
Requires-Dist: nbconvert>=7.16.6
|
|
@@ -79,6 +80,7 @@ Requires-Dist: streamlit>=1.49.0
|
|
|
79
80
|
Requires-Dist: typer
|
|
80
81
|
Requires-Dist: types-cachetools>=6.2.0.20251022
|
|
81
82
|
Requires-Dist: types-decorator>=5.2.0.20250324
|
|
83
|
+
Requires-Dist: types-markdown>=3.10.0.20251106
|
|
82
84
|
Requires-Dist: types-openpyxl>=3.1.5.20250919
|
|
83
85
|
Requires-Dist: types-pycurl>=7.45.7.20250926
|
|
84
86
|
Requires-Dist: types-python-dateutil>=2.9.0.20251008
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mayutils"
|
|
3
|
-
version = "1.2.
|
|
3
|
+
version = "1.2.38"
|
|
4
4
|
description = "Utilities for Python from Mayuran Visakan"
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Mayuran Visakan", email = "mayuran.k.v@gmail.com" }
|
|
@@ -30,6 +30,7 @@ dependencies = [
|
|
|
30
30
|
"jupyter>=1.1.1",
|
|
31
31
|
"kaleido>=1.0.0",
|
|
32
32
|
"keyring>=25.6.0",
|
|
33
|
+
"markdown",
|
|
33
34
|
"matplotlib>=3.10.5",
|
|
34
35
|
"modin[all]>=0.35.0",
|
|
35
36
|
"nbconvert>=7.16.6",
|
|
@@ -66,6 +67,7 @@ dependencies = [
|
|
|
66
67
|
"typer",
|
|
67
68
|
"types-cachetools>=6.2.0.20251022",
|
|
68
69
|
"types-decorator>=5.2.0.20250324",
|
|
70
|
+
"types-markdown>=3.10.0.20251106",
|
|
69
71
|
"types-openpyxl>=3.1.5.20250919",
|
|
70
72
|
"types-pycurl>=7.45.7.20250926",
|
|
71
73
|
"types-python-dateutil>=2.9.0.20251008",
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import time
|
|
2
|
+
from typing import Optional
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from html2image import Html2Image
|
|
5
|
+
from markdown import markdown
|
|
6
|
+
from mayutils.environment.logging import Logger
|
|
7
|
+
|
|
8
|
+
H2I = Html2Image()
|
|
9
|
+
logger = Logger.spawn()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def markdown_to_html(
|
|
13
|
+
text: str,
|
|
14
|
+
) -> str:
|
|
15
|
+
return markdown(
|
|
16
|
+
text=text,
|
|
17
|
+
).replace(
|
|
18
|
+
"\n",
|
|
19
|
+
"<br>",
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def html_to_image(
|
|
24
|
+
html: str,
|
|
25
|
+
path: Path | str,
|
|
26
|
+
css: Optional[str] = None,
|
|
27
|
+
size: Optional[tuple[int, int]] = None,
|
|
28
|
+
sleep_time: int = 1,
|
|
29
|
+
) -> Path:
|
|
30
|
+
path = Path(path)
|
|
31
|
+
|
|
32
|
+
kwargs = {}
|
|
33
|
+
|
|
34
|
+
if size is not None:
|
|
35
|
+
kwargs["size"] = size
|
|
36
|
+
|
|
37
|
+
H2I.screenshot(
|
|
38
|
+
html_str=html,
|
|
39
|
+
css_str=css or "",
|
|
40
|
+
save_as=path.name,
|
|
41
|
+
**kwargs,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
time.sleep(0.5)
|
|
45
|
+
while not path.exists():
|
|
46
|
+
logger.debug(f"Waiting {sleep_time} second for {path} to be created...")
|
|
47
|
+
time.sleep(sleep_time)
|
|
48
|
+
|
|
49
|
+
Path(path.name).replace(target=path)
|
|
50
|
+
|
|
51
|
+
return path
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def html_pill(
|
|
55
|
+
text: str,
|
|
56
|
+
background_colour: str,
|
|
57
|
+
text_colour: str = "black",
|
|
58
|
+
bold: bool = True,
|
|
59
|
+
padding: tuple[float, float] = (0.2, 0.4),
|
|
60
|
+
relative_font_size: float = 0.9,
|
|
61
|
+
rounding: float = 5.625,
|
|
62
|
+
) -> str:
|
|
63
|
+
return f'<span style="display: inline-block; background-color: {background_colour}; color: {text_colour}; padding: {padding[0]}em {padding[1]}em; border-radius: {rounding}em; font-size: {relative_font_size}em; font-weight: {"bold" if bold else "normal"};">{text}</span>'
|
|
@@ -1319,7 +1319,7 @@ class Plot(go.Figure):
|
|
|
1319
1319
|
|
|
1320
1320
|
return self
|
|
1321
1321
|
|
|
1322
|
-
def
|
|
1322
|
+
def set_visible_y_range(
|
|
1323
1323
|
self,
|
|
1324
1324
|
y_min: Optional[float] = None,
|
|
1325
1325
|
y_max: Optional[float] = None,
|
|
@@ -1328,28 +1328,49 @@ class Plot(go.Figure):
|
|
|
1328
1328
|
for yaxis in [prop for prop in self.layout if prop.startswith("yaxis")]:
|
|
1329
1329
|
yaxis_suffix = yaxis.removeprefix("yaxis")
|
|
1330
1330
|
|
|
1331
|
-
trace_limits =
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1331
|
+
trace_limits = np.asarray(
|
|
1332
|
+
[
|
|
1333
|
+
(
|
|
1334
|
+
np.nanmin(visible_y)
|
|
1335
|
+
if not (np.isnan(visible_y := trace.y[visible_mask])).all()
|
|
1336
|
+
and not visible_y.shape == (0,)
|
|
1337
|
+
else np.nan,
|
|
1338
|
+
np.nanmax(visible_y)
|
|
1339
|
+
if not (np.isnan(visible_y)).all()
|
|
1340
|
+
and not visible_y.shape == (0,)
|
|
1341
|
+
else np.nan,
|
|
1342
|
+
)
|
|
1343
|
+
for trace in self.data
|
|
1344
|
+
if (trace.visible is None or trace.visible is True)
|
|
1345
|
+
and isinstance(trace.y, np.ndarray)
|
|
1346
|
+
and trace.yaxis == f"y{yaxis_suffix}"
|
|
1347
|
+
and (
|
|
1348
|
+
visible_mask := (trace.x < self.layout.xaxis.range[1]) # type: ignore
|
|
1349
|
+
& (trace.x > self.layout.xaxis.range[0]) # type: ignore
|
|
1350
|
+
).any()
|
|
1351
|
+
]
|
|
1352
|
+
)
|
|
1348
1353
|
|
|
1349
|
-
|
|
1350
|
-
(
|
|
1351
|
-
|
|
1354
|
+
traces_min = (
|
|
1355
|
+
np.nanmin(trace_limits) if not np.isnan(trace_limits).all() else None
|
|
1356
|
+
)
|
|
1357
|
+
traces_max = (
|
|
1358
|
+
np.nanmax(trace_limits) if not np.isnan(trace_limits).all() else None
|
|
1352
1359
|
)
|
|
1360
|
+
|
|
1361
|
+
if traces_min is not None and traces_max is not None:
|
|
1362
|
+
span = traces_max - traces_min
|
|
1363
|
+
|
|
1364
|
+
y_range = (
|
|
1365
|
+
(traces_min - span * y_padding).clip(min=y_min),
|
|
1366
|
+
(traces_max + span * y_padding).clip(max=y_max),
|
|
1367
|
+
)
|
|
1368
|
+
else:
|
|
1369
|
+
y_range = (
|
|
1370
|
+
traces_min * (1 - y_padding) if traces_min is not None else None,
|
|
1371
|
+
traces_max * (1 + y_padding) if traces_max is not None else None,
|
|
1372
|
+
)
|
|
1373
|
+
|
|
1353
1374
|
self.update_layout(
|
|
1354
1375
|
{
|
|
1355
1376
|
f"yaxis{yaxis_suffix}_range": y_range,
|
|
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
|
|
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
|
|
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
|
{mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/visualisation/graphs/matplotlib/__init__.py
RENAMED
|
File without changes
|
{mayutils-1.2.37 → mayutils-1.2.38}/src/mayutils/visualisation/graphs/matplotlib/template.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|