murali-kit 0.1.0__py3-none-any.whl
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.
- murali_kit/__init__.py +13 -0
- murali_kit/_compat.py +30 -0
- murali_kit/ai/__init__.py +3 -0
- murali_kit/collection/__init__.py +5 -0
- murali_kit/collection/title_card.py +72 -0
- murali_kit/maths/__init__.py +3 -0
- murali_kit/maths/linear_algebra/__init__.py +3 -0
- murali_kit-0.1.0.dist-info/METADATA +116 -0
- murali_kit-0.1.0.dist-info/RECORD +10 -0
- murali_kit-0.1.0.dist-info/WHEEL +4 -0
murali_kit/__init__.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Free Python authoring kit and add-ons for Murali Engine."""
|
|
2
|
+
|
|
3
|
+
from ._compat import ENGINE_IMPORT_NAME, SUPPORTED_ENGINE, engine_available, require_engine
|
|
4
|
+
|
|
5
|
+
__version__ = "0.1.0"
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"ENGINE_IMPORT_NAME",
|
|
9
|
+
"SUPPORTED_ENGINE",
|
|
10
|
+
"__version__",
|
|
11
|
+
"engine_available",
|
|
12
|
+
"require_engine",
|
|
13
|
+
]
|
murali_kit/_compat.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Compatibility helpers for the Murali Engine Python package."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import importlib
|
|
6
|
+
import importlib.util
|
|
7
|
+
from types import ModuleType
|
|
8
|
+
|
|
9
|
+
ENGINE_IMPORT_NAME = "murali_engine"
|
|
10
|
+
SUPPORTED_ENGINE = ">=0.2.5,<0.3.0"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def engine_available() -> bool:
|
|
14
|
+
"""Return whether the Murali Engine Python bindings are importable."""
|
|
15
|
+
|
|
16
|
+
return importlib.util.find_spec(ENGINE_IMPORT_NAME) is not None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def require_engine() -> ModuleType:
|
|
20
|
+
"""Import Murali Engine or raise a clear setup error."""
|
|
21
|
+
|
|
22
|
+
try:
|
|
23
|
+
return importlib.import_module(ENGINE_IMPORT_NAME)
|
|
24
|
+
except ImportError as exc:
|
|
25
|
+
msg = (
|
|
26
|
+
"murali-kit requires the murali-engine Python package for rendering. "
|
|
27
|
+
f"Expected engine compatibility: {SUPPORTED_ENGINE}. "
|
|
28
|
+
"For local development, run: python -m pip install -r requirements-local.txt"
|
|
29
|
+
)
|
|
30
|
+
raise RuntimeError(msg) from exc
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""Reusable title card composition for Murali scenes."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from murali_kit._compat import require_engine
|
|
9
|
+
|
|
10
|
+
Color = tuple[float, float, float, float]
|
|
11
|
+
Vec3 = tuple[float, float, float]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(slots=True)
|
|
15
|
+
class TitleCard:
|
|
16
|
+
"""A small title/subtitle/card composition built from core engine primitives."""
|
|
17
|
+
|
|
18
|
+
title: str
|
|
19
|
+
subtitle: str | None = None
|
|
20
|
+
width: float = 5.8
|
|
21
|
+
height: float = 1.6
|
|
22
|
+
title_height: float = 0.34
|
|
23
|
+
subtitle_height: float = 0.2
|
|
24
|
+
fill: Color | None = None
|
|
25
|
+
stroke: Color | None = None
|
|
26
|
+
title_color: Color | None = None
|
|
27
|
+
subtitle_color: Color | None = None
|
|
28
|
+
|
|
29
|
+
def add_to_scene(self, scene: Any, at: Vec3 = (0.0, 0.0, 0.0)) -> "TitleCardHandles":
|
|
30
|
+
engine = require_engine()
|
|
31
|
+
|
|
32
|
+
fill = self.fill or (0.05, 0.10, 0.15, 0.96)
|
|
33
|
+
stroke = self.stroke or engine.WHITE
|
|
34
|
+
title_color = self.title_color or engine.WHITE
|
|
35
|
+
subtitle_color = self.subtitle_color or (0.75, 0.80, 0.86, 1.0)
|
|
36
|
+
|
|
37
|
+
card = engine.Rectangle(width=self.width, height=self.height, color=fill)
|
|
38
|
+
card.with_stroke(0.025, stroke)
|
|
39
|
+
|
|
40
|
+
x, y, z = at
|
|
41
|
+
card_handle = scene.add(card, at=at)
|
|
42
|
+
title_handle = scene.add(
|
|
43
|
+
engine.Label(self.title, height=self.title_height, color=title_color),
|
|
44
|
+
at=(x, y + 0.18, z + 0.01),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
subtitle_handle = None
|
|
48
|
+
if self.subtitle:
|
|
49
|
+
subtitle_handle = scene.add(
|
|
50
|
+
engine.Label(self.subtitle, height=self.subtitle_height, color=subtitle_color),
|
|
51
|
+
at=(x, y - 0.28, z + 0.01),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
return TitleCardHandles(
|
|
55
|
+
card=card_handle,
|
|
56
|
+
title=title_handle,
|
|
57
|
+
subtitle=subtitle_handle,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@dataclass(frozen=True, slots=True)
|
|
62
|
+
class TitleCardHandles:
|
|
63
|
+
card: Any
|
|
64
|
+
title: Any
|
|
65
|
+
subtitle: Any | None = None
|
|
66
|
+
|
|
67
|
+
@property
|
|
68
|
+
def all(self) -> tuple[Any, ...]:
|
|
69
|
+
handles = [self.card, self.title]
|
|
70
|
+
if self.subtitle is not None:
|
|
71
|
+
handles.append(self.subtitle)
|
|
72
|
+
return tuple(handles)
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: murali-kit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Free Python authoring kit and add-ons for Murali Engine.
|
|
5
|
+
Project-URL: Homepage, https://github.com/murali-engine/murali-kit
|
|
6
|
+
Project-URL: Repository, https://github.com/murali-engine/murali-kit
|
|
7
|
+
Project-URL: Engine, https://github.com/murali-engine/murali
|
|
8
|
+
Author: Murali Engine
|
|
9
|
+
License: MIT OR Apache-2.0
|
|
10
|
+
Keywords: ai,animation,education,math,visualization
|
|
11
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
12
|
+
Classifier: Intended Audience :: Education
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: murali-engine<0.3.0,>=0.2.5
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# Murali Kit
|
|
24
|
+
|
|
25
|
+
Free Python authoring components and add-ons for Murali Engine.
|
|
26
|
+
|
|
27
|
+
This repository is the free companion package for higher-level Murali visuals, examples, and
|
|
28
|
+
education-focused helpers. The core runtime and PyO3 engine bindings live in the
|
|
29
|
+
[`murali-engine/murali`](https://github.com/murali-engine/murali) repository.
|
|
30
|
+
|
|
31
|
+
## Boundary
|
|
32
|
+
|
|
33
|
+
- `murali-engine`: Rust engine, renderer, scene graph, timelines, preview/export, and Python
|
|
34
|
+
bindings for the core runtime.
|
|
35
|
+
- `murali-kit`: Python add-ons built on top of `murali-engine`.
|
|
36
|
+
|
|
37
|
+
The current split is non-destructive. Existing Rust collection code remains in the engine repo until
|
|
38
|
+
each add-on surface has a Python equivalent and a stable engine contract.
|
|
39
|
+
|
|
40
|
+
See [docs/SPLIT_PLAN.md](docs/SPLIT_PLAN.md) for the migration plan.
|
|
41
|
+
|
|
42
|
+
## First Component
|
|
43
|
+
|
|
44
|
+
`murali-kit` now includes a small `TitleCard` composition:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from murali_engine import Scene
|
|
48
|
+
from murali_kit.collection import TitleCard
|
|
49
|
+
|
|
50
|
+
scene = Scene()
|
|
51
|
+
handles = TitleCard("Murali Kit", "Python add-ons for Murali Engine").add_to_scene(scene)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`murali-kit` depends on the `murali-engine` Python package:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
python3 -m pip install murali-kit==0.1.0
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
During local development, create a virtual environment inside this repo and install the adjacent
|
|
61
|
+
engine checkout plus this kit package:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
python3 -m venv .venv
|
|
65
|
+
.venv/bin/python -m pip install -r requirements-local.txt
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Activate the environment:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
source .venv/bin/activate
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Run the examples:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
python examples/core_surfaces.py
|
|
78
|
+
python examples/hello_shapes.py
|
|
79
|
+
python examples/shapes_and_layout.py
|
|
80
|
+
python examples/three_d_scene.py
|
|
81
|
+
python examples/title_card.py
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
By default these open the preview window. To export a single PNG frame instead:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
python examples/core_surfaces.py --png
|
|
88
|
+
python examples/hello_shapes.py --png
|
|
89
|
+
python examples/shapes_and_layout.py --png
|
|
90
|
+
python examples/three_d_scene.py --png
|
|
91
|
+
python examples/title_card.py --png
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
To try every Python example one by one:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
python preview_all.py
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
For a non-window export pass:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
python preview_all.py --png
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
You can also run them without activation:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
.venv/bin/python examples/core_surfaces.py
|
|
110
|
+
.venv/bin/python examples/hello_shapes.py
|
|
111
|
+
.venv/bin/python examples/shapes_and_layout.py
|
|
112
|
+
.venv/bin/python examples/three_d_scene.py
|
|
113
|
+
.venv/bin/python examples/title_card.py
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
See [RUNNING_EXAMPLES.md](RUNNING_EXAMPLES.md) for the full local workflow.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
murali_kit/__init__.py,sha256=RriIG21ur6smvPfhrHjMlS6ETFb1wQDCwa2iSPCKxIw,309
|
|
2
|
+
murali_kit/_compat.py,sha256=_DOz2VoT-fFge4PSXulrLhD4UwBoJNGzQWANaQQAEGU,929
|
|
3
|
+
murali_kit/ai/__init__.py,sha256=uw-MEIQmFr1h-nDmEsyTRtL6cJ0FC6ju-5JmgYVdgtw,75
|
|
4
|
+
murali_kit/collection/__init__.py,sha256=o7rOPO_94TQRFV0K91PeFzuxFoUOc01NsPHO1FCHDYM,160
|
|
5
|
+
murali_kit/collection/title_card.py,sha256=axSbdX-Wg3evzSfR5KrGrgJvhnqjuKZ7hWDybNImm7E,2133
|
|
6
|
+
murali_kit/maths/__init__.py,sha256=kfzXRVEpqaJ3xop25ZJE2QrL2sSVGxEU7qIafvdwMn8,71
|
|
7
|
+
murali_kit/maths/linear_algebra/__init__.py,sha256=BBxB5achnBAqeApsrwcX1QaPzYL-8MoGxdrH0RctXYE,86
|
|
8
|
+
murali_kit-0.1.0.dist-info/METADATA,sha256=tGo4CdimBdxJgzlOZFZnSdvbZxomqFxfFZ395LhzAf8,3375
|
|
9
|
+
murali_kit-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
10
|
+
murali_kit-0.1.0.dist-info/RECORD,,
|