galaga-anywidget 2.0.0a2__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.
- galaga_anywidget-2.0.0a2/.gitignore +21 -0
- galaga_anywidget-2.0.0a2/PKG-INFO +95 -0
- galaga_anywidget-2.0.0a2/README.md +66 -0
- galaga_anywidget-2.0.0a2/galaga_anywidget/__init__.py +16 -0
- galaga_anywidget-2.0.0a2/galaga_anywidget/cga2d.py +790 -0
- galaga_anywidget-2.0.0a2/galaga_anywidget/static/cga2d.css +112 -0
- galaga_anywidget-2.0.0a2/galaga_anywidget/static/cga2d.js +494 -0
- galaga_anywidget-2.0.0a2/galaga_anywidget/viz.py +707 -0
- galaga_anywidget-2.0.0a2/pyproject.toml +47 -0
- galaga_anywidget-2.0.0a2/tests/test_package_boundary.py +32 -0
- galaga_anywidget-2.0.0a2/tests/test_visualization_cga2d.py +913 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv
|
|
11
|
+
.coverage
|
|
12
|
+
.DS_Store
|
|
13
|
+
__marimo__/
|
|
14
|
+
# Vim
|
|
15
|
+
*.swp
|
|
16
|
+
*.swo
|
|
17
|
+
*~
|
|
18
|
+
test.py
|
|
19
|
+
.kiro/
|
|
20
|
+
.session.jsonl
|
|
21
|
+
.spacebot/
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: galaga-anywidget
|
|
3
|
+
Version: 2.0.0a2
|
|
4
|
+
Summary: Interactive AnyWidget visualizations for Galaga geometric algebra
|
|
5
|
+
Project-URL: Homepage, https://github.com/edouardp/galaga
|
|
6
|
+
Project-URL: Repository, https://github.com/edouardp/galaga
|
|
7
|
+
Project-URL: Issues, https://github.com/edouardp/galaga/issues
|
|
8
|
+
Author: Edouard Poor
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: anywidget,cga,geometric-algebra,marimo,visualization
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Education
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: anywidget>=0.9
|
|
24
|
+
Requires-Dist: galaga>=2.0.0a2
|
|
25
|
+
Requires-Dist: marimo<0.25,>=0.23.14
|
|
26
|
+
Requires-Dist: numpy>=1.24
|
|
27
|
+
Requires-Dist: traitlets>=5.14
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# galaga-anywidget
|
|
31
|
+
|
|
32
|
+
Interactive AnyWidget visualizations for Galaga geometric algebra.
|
|
33
|
+
|
|
34
|
+
The first renderer draws direct points, dipoles, lines, and circles in a
|
|
35
|
+
two-dimensional conformal model. It owns semantic Euclidean point coordinates,
|
|
36
|
+
so browser drags participate in Marimo's normal reactive execution while the
|
|
37
|
+
notebook keeps all geometric constructions in Python.
|
|
38
|
+
|
|
39
|
+
During the Galaga 2 prerelease train:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
python -m pip install --pre "galaga-anywidget>=2.0.0a1,<3"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Persistent reactive construction
|
|
46
|
+
|
|
47
|
+
Construct and render the visualization in a cell that has no dependency on
|
|
48
|
+
changing geometry:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import galaga_anywidget.viz as viz
|
|
52
|
+
|
|
53
|
+
circle_viz = viz.CGA2D(
|
|
54
|
+
cga,
|
|
55
|
+
colors=["#0072B2", "#D55E00", "#009E73", "#7C3AED"],
|
|
56
|
+
)
|
|
57
|
+
circle_viz
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Read named coordinates in another cell and construct ordinary multivectors:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
px, py = circle_viz.coordinates("P", default=(-1.75, -0.75))
|
|
64
|
+
qx, qy = circle_viz.coordinates("Q", default=(0.25, 1.5))
|
|
65
|
+
rx, ry = circle_viz.coordinates("R", default=(1.75, -0.5))
|
|
66
|
+
|
|
67
|
+
P = cga.up(px, py).named("P")
|
|
68
|
+
Q = cga.up(qx, qy).named("Q")
|
|
69
|
+
R = cga.up(rx, ry).named("R")
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Keep the derived algebra in its own ordinary cell:
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
C = (P ^ Q ^ R).named("C")
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Then synchronize the current values into the persistent widget:
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
circle_viz.display([P, Q, R], immutable=[C])
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The three points are draggable and the dotted circle is read-only. Dragging a
|
|
85
|
+
point updates the named coordinate pair, which causes Marimo to reconstruct
|
|
86
|
+
the conformal point and every dependent value. The widget never duplicates the
|
|
87
|
+
circle construction in JavaScript.
|
|
88
|
+
|
|
89
|
+
For compact static or one-cell views, use
|
|
90
|
+
`viz.display([point, dipole, line, circle], model=cga)`. The lower-level
|
|
91
|
+
`CGA2DPlot` API supports explicit keys, replacements, dependent geometry, and
|
|
92
|
+
solid, dashed, or dotted line styles.
|
|
93
|
+
|
|
94
|
+
The design and interaction lessons are recorded in
|
|
95
|
+
[GALAGA_ANYWIDGET.md](https://github.com/edouardp/galaga/blob/main/GALAGA_ANYWIDGET.md).
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# galaga-anywidget
|
|
2
|
+
|
|
3
|
+
Interactive AnyWidget visualizations for Galaga geometric algebra.
|
|
4
|
+
|
|
5
|
+
The first renderer draws direct points, dipoles, lines, and circles in a
|
|
6
|
+
two-dimensional conformal model. It owns semantic Euclidean point coordinates,
|
|
7
|
+
so browser drags participate in Marimo's normal reactive execution while the
|
|
8
|
+
notebook keeps all geometric constructions in Python.
|
|
9
|
+
|
|
10
|
+
During the Galaga 2 prerelease train:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
python -m pip install --pre "galaga-anywidget>=2.0.0a1,<3"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Persistent reactive construction
|
|
17
|
+
|
|
18
|
+
Construct and render the visualization in a cell that has no dependency on
|
|
19
|
+
changing geometry:
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
import galaga_anywidget.viz as viz
|
|
23
|
+
|
|
24
|
+
circle_viz = viz.CGA2D(
|
|
25
|
+
cga,
|
|
26
|
+
colors=["#0072B2", "#D55E00", "#009E73", "#7C3AED"],
|
|
27
|
+
)
|
|
28
|
+
circle_viz
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Read named coordinates in another cell and construct ordinary multivectors:
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
px, py = circle_viz.coordinates("P", default=(-1.75, -0.75))
|
|
35
|
+
qx, qy = circle_viz.coordinates("Q", default=(0.25, 1.5))
|
|
36
|
+
rx, ry = circle_viz.coordinates("R", default=(1.75, -0.5))
|
|
37
|
+
|
|
38
|
+
P = cga.up(px, py).named("P")
|
|
39
|
+
Q = cga.up(qx, qy).named("Q")
|
|
40
|
+
R = cga.up(rx, ry).named("R")
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Keep the derived algebra in its own ordinary cell:
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
C = (P ^ Q ^ R).named("C")
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Then synchronize the current values into the persistent widget:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
circle_viz.display([P, Q, R], immutable=[C])
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The three points are draggable and the dotted circle is read-only. Dragging a
|
|
56
|
+
point updates the named coordinate pair, which causes Marimo to reconstruct
|
|
57
|
+
the conformal point and every dependent value. The widget never duplicates the
|
|
58
|
+
circle construction in JavaScript.
|
|
59
|
+
|
|
60
|
+
For compact static or one-cell views, use
|
|
61
|
+
`viz.display([point, dipole, line, circle], model=cga)`. The lower-level
|
|
62
|
+
`CGA2DPlot` API supports explicit keys, replacements, dependent geometry, and
|
|
63
|
+
solid, dashed, or dotted line styles.
|
|
64
|
+
|
|
65
|
+
The design and interaction lessons are recorded in
|
|
66
|
+
[GALAGA_ANYWIDGET.md](https://github.com/edouardp/galaga/blob/main/GALAGA_ANYWIDGET.md).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Interactive AnyWidget visualizations for Galaga geometric algebra."""
|
|
2
|
+
|
|
3
|
+
from . import viz
|
|
4
|
+
from .cga2d import DEFAULT_COLOR_CYCLE, CGA2DChange, CGA2DKind, CGA2DLineStyle, CGA2DPlot, cga2d
|
|
5
|
+
from .viz import CGA2D
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"CGA2DKind",
|
|
9
|
+
"CGA2DLineStyle",
|
|
10
|
+
"CGA2DChange",
|
|
11
|
+
"CGA2DPlot",
|
|
12
|
+
"CGA2D",
|
|
13
|
+
"DEFAULT_COLOR_CYCLE",
|
|
14
|
+
"cga2d",
|
|
15
|
+
"viz",
|
|
16
|
+
]
|