sigillin 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.
sigillin/__init__.py ADDED
@@ -0,0 +1,6 @@
1
+ """sigillin – the poetic-symbolic interface layer of the GenesisAeon stack."""
2
+
3
+ __version__ = "0.1.0"
4
+ __all__ = ["Sigil"]
5
+
6
+ from .core import Sigil
sigillin/cli.py ADDED
@@ -0,0 +1,91 @@
1
+ """Sigillin CLI – sig validate / render / inspect / bridge."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+
7
+ import typer
8
+ from rich.console import Console
9
+ from rich.table import Table
10
+
11
+ from .core import Sigil
12
+
13
+ app = typer.Typer(
14
+ name="sig",
15
+ help="Sigillin CLI – poetic-symbolic sigil engine",
16
+ add_completion=False,
17
+ )
18
+ console = Console()
19
+
20
+ _CREP_KEYS = ("coherence", "resonance", "emergence", "poetics")
21
+
22
+
23
+ @app.command()
24
+ def validate(
25
+ path: Path = typer.Argument(..., help="Path to sigil file (YAML/JSON/Markdown)"),
26
+ ) -> None:
27
+ """Validate a sigil against the CREP schema (Coherence · Resonance · Emergence)."""
28
+ if not path.exists():
29
+ console.print(f"[bold red]✗ File not found:[/] {path}")
30
+ raise typer.Exit(1)
31
+ sigil = Sigil(path)
32
+ if sigil.validate_crep():
33
+ console.print(f"[bold green]✓ Sigil valid – CREP-aligned[/] ({path.name})")
34
+ else:
35
+ missing = [k for k in _CREP_KEYS if k not in sigil.data]
36
+ console.print(f"[bold red]✗ Sigil invalid[/] ({path.name})")
37
+ console.print(f" Missing CREP keys: [yellow]{', '.join(missing)}[/]")
38
+ raise typer.Exit(1)
39
+
40
+
41
+ @app.command()
42
+ def render(
43
+ path: Path = typer.Argument(..., help="Path to sigil file"),
44
+ depth: float = typer.Option(0.618, help="Fractal resonance depth (default: φ)"),
45
+ ) -> None:
46
+ """Render the MandalaMap resonance spectrum for a sigil."""
47
+ if not path.exists():
48
+ console.print(f"[bold red]✗ File not found:[/] {path}")
49
+ raise typer.Exit(1)
50
+ sigil = Sigil(path)
51
+ spectrum = sigil.render_mandala(depth)
52
+ console.print(f"[bold magenta]Mandala resonance peak:[/] {spectrum.max():.4f}")
53
+ console.print(f"[bold magenta]Mandala resonance mean:[/] {spectrum.mean():.4f}")
54
+ console.print(sigil.bind_to_field())
55
+
56
+
57
+ @app.command()
58
+ def inspect(
59
+ path: Path = typer.Argument(..., help="Path to sigil file"),
60
+ ) -> None:
61
+ """Inspect sigil fields in a rich table."""
62
+ if not path.exists():
63
+ console.print(f"[bold red]✗ File not found:[/] {path}")
64
+ raise typer.Exit(1)
65
+ sigil = Sigil(path)
66
+ table = Table(
67
+ title=f"Sigil: {path.name}",
68
+ show_header=True,
69
+ header_style="bold cyan",
70
+ )
71
+ table.add_column("Key", style="cyan")
72
+ table.add_column("Value")
73
+ for k, v in sigil.data.items():
74
+ table.add_row(str(k), str(v))
75
+ console.print(table)
76
+ crep_status = "[green]✓ valid[/]" if sigil.validate_crep() else "[red]✗ invalid[/]"
77
+ console.print(f"CREP status: {crep_status}")
78
+
79
+
80
+ @app.command()
81
+ def bridge(
82
+ provider: str = typer.Argument("openai", help="Provider name for bridge"),
83
+ ) -> None:
84
+ """Create a self-referential provider bridge."""
85
+ console.print(
86
+ f"[bold cyan]Selfmeta bridge for [white]{provider}[/white] created[/]"
87
+ )
88
+
89
+
90
+ if __name__ == "__main__":
91
+ app()
sigillin/core.py ADDED
@@ -0,0 +1,129 @@
1
+ """SigilParser – trilayer YAML/JSON/Markdown loader with CREP validation."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+ import numpy as np
10
+ import yaml
11
+ from rich.console import Console
12
+
13
+ console = Console()
14
+
15
+ CREP_KEYS = ("coherence", "resonance", "emergence", "poetics")
16
+
17
+
18
+ class SigilValidationError(ValueError):
19
+ """Raised when a sigil fails CREP validation."""
20
+
21
+
22
+ class Sigil:
23
+ """Self-referential poetic-symbolic attractor.
24
+
25
+ Supports three source formats (trilayer):
26
+ - ``.yaml`` / ``.yml`` — structural definition (primary)
27
+ - ``.json`` — machine-readable export
28
+ - ``.md`` — narrative / free-form (parses YAML front-matter)
29
+ """
30
+
31
+ def __init__(self, filepath: Path | str) -> None:
32
+ self.path = Path(filepath)
33
+ self.data: dict[str, Any] = self._load_trilayer()
34
+
35
+ # ------------------------------------------------------------------
36
+ # Trilayer loading
37
+ # ------------------------------------------------------------------
38
+
39
+ def _load_trilayer(self) -> dict[str, Any]:
40
+ suffix = self.path.suffix.lower()
41
+ if suffix in {".yaml", ".yml"}:
42
+ return self._load_yaml()
43
+ if suffix == ".json":
44
+ return self._load_json()
45
+ if suffix == ".md":
46
+ return self._load_markdown_frontmatter()
47
+ # Fallback: try YAML first, then JSON
48
+ try:
49
+ return self._load_yaml()
50
+ except Exception:
51
+ return self._load_json()
52
+
53
+ def _load_yaml(self) -> dict[str, Any]:
54
+ with self.path.open(encoding="utf-8") as f:
55
+ return yaml.safe_load(f) or {}
56
+
57
+ def _load_json(self) -> dict[str, Any]:
58
+ with self.path.open(encoding="utf-8") as f:
59
+ return json.load(f)
60
+
61
+ def _load_markdown_frontmatter(self) -> dict[str, Any]:
62
+ """Extract YAML front-matter between ``---`` fences."""
63
+ text = self.path.read_text(encoding="utf-8")
64
+ lines = text.splitlines()
65
+ if lines and lines[0].strip() == "---":
66
+ end = next(
67
+ (i for i, ln in enumerate(lines[1:], 1) if ln.strip() == "---"),
68
+ None,
69
+ )
70
+ if end is not None:
71
+ front = "\n".join(lines[1:end])
72
+ return yaml.safe_load(front) or {}
73
+ return {}
74
+
75
+ # ------------------------------------------------------------------
76
+ # CREP validation
77
+ # ------------------------------------------------------------------
78
+
79
+ def validate_crep(self) -> bool:
80
+ """Return True if all four CREP keys are present."""
81
+ return all(k in self.data for k in CREP_KEYS)
82
+
83
+ def assert_crep(self) -> None:
84
+ """Raise :class:`SigilValidationError` if CREP keys are missing."""
85
+ missing = [k for k in CREP_KEYS if k not in self.data]
86
+ if missing:
87
+ raise SigilValidationError(
88
+ f"Sigil {self.path.name!r} is missing CREP keys: {missing}"
89
+ )
90
+
91
+ # ------------------------------------------------------------------
92
+ # MandalaMap resonance
93
+ # ------------------------------------------------------------------
94
+
95
+ def render_mandala(self, depth: float = 0.618) -> np.ndarray:
96
+ """Return a fractal resonance spectrum (placeholder MandalaMap binding).
97
+
98
+ The golden-ratio depth parameter (φ ≈ 0.618) controls the oscillation
99
+ frequency. The returned array can be handed to fieldtheory for full
100
+ Lagrangian integration when the ``[stack]`` extra is installed.
101
+ """
102
+ t = np.linspace(0, 10, 100)
103
+ return np.sin(t * depth) * 1.618 # φ-scaled resonance spectrum
104
+
105
+ # ------------------------------------------------------------------
106
+ # Optional fieldtheory binding
107
+ # ------------------------------------------------------------------
108
+
109
+ def bind_to_field(self) -> str:
110
+ """Bind this sigil to the fieldtheory Lagrangian (requires ``[stack]``)."""
111
+ try:
112
+ from fieldtheory.core import derive_lagrangian # type: ignore[import]
113
+
114
+ return str(derive_lagrangian())
115
+ except ImportError:
116
+ return "Lagrangian binding available with: pip install sigillin[stack]"
117
+
118
+ # ------------------------------------------------------------------
119
+ # Dunder helpers
120
+ # ------------------------------------------------------------------
121
+
122
+ def __repr__(self) -> str:
123
+ return f"Sigil(path={self.path!r}, crep_valid={self.validate_crep()})"
124
+
125
+ def __getitem__(self, key: str) -> Any:
126
+ return self.data[key]
127
+
128
+ def get(self, key: str, default: Any = None) -> Any:
129
+ return self.data.get(key, default)
@@ -0,0 +1,50 @@
1
+ """entropy-table bridge – export sigillin data into entropy-table format.
2
+
3
+ Requires ``sigillin[stack]`` (``entropy-table>=1.0.1``).
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ from pathlib import Path
9
+ from typing import Any
10
+
11
+ from .core import Sigil
12
+
13
+
14
+ def sigil_to_entropy_record(sigil: Sigil) -> dict[str, Any]:
15
+ """Convert a :class:`Sigil` to a flat entropy-table record.
16
+
17
+ The record schema mirrors the trilayer CREP structure so that it can be
18
+ ingested directly by ``entropy_table.register()``.
19
+ """
20
+ spectrum = sigil.render_mandala()
21
+ return {
22
+ "name": sigil.path.stem,
23
+ "coherence": sigil.get("coherence", 0.0),
24
+ "resonance": sigil.get("resonance", 0.0),
25
+ "emergence": sigil.get("emergence", 0.0),
26
+ "poetics": sigil.get("poetics", ""),
27
+ "mandala_peak": float(spectrum.max()),
28
+ "mandala_mean": float(spectrum.mean()),
29
+ "source_path": str(sigil.path),
30
+ "crep_valid": sigil.validate_crep(),
31
+ }
32
+
33
+
34
+ def export_to_entropy_table(path: Path | str) -> None:
35
+ """Load a sigil and register it with entropy-table (requires ``[stack]``).
36
+
37
+ Raises :class:`ImportError` with a helpful message when the ``[stack]``
38
+ extra is not installed.
39
+ """
40
+ try:
41
+ from entropy_table import register # type: ignore[import]
42
+ except ImportError as exc:
43
+ raise ImportError(
44
+ "entropy-table is not installed. "
45
+ "Install it with: pip install sigillin[stack]"
46
+ ) from exc
47
+
48
+ sigil = Sigil(path)
49
+ record = sigil_to_entropy_record(sigil)
50
+ register(record)
@@ -0,0 +1,163 @@
1
+ Metadata-Version: 2.4
2
+ Name: sigillin
3
+ Version: 0.1.0
4
+ Summary: The poetic-symbolic interface layer of the GenesisAeon stack – self-referential sigil parser, trilayer validation (YAML/JSON/Markdown) and MandalaMap resonance.
5
+ Project-URL: Repository, https://github.com/GenesisAeon/sigillin
6
+ Project-URL: Issues, https://github.com/GenesisAeon/sigillin/issues
7
+ Author-email: GenesisAeon Team <team@genesisaeon.org>
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: crep,genesisaeon,mandala,poetry,sigil,symbolic,trilayer
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
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: Topic :: Artistic Software
19
+ Classifier: Topic :: Scientific/Engineering
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: numpy>=1.26
22
+ Requires-Dist: pyyaml>=6.0
23
+ Requires-Dist: rich>=13.0
24
+ Requires-Dist: typer>=0.15.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pre-commit>=3.7.0; extra == 'dev'
27
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
28
+ Requires-Dist: pytest>=8.0; extra == 'dev'
29
+ Requires-Dist: ruff>=0.9; extra == 'dev'
30
+ Provides-Extra: docs
31
+ Requires-Dist: mkdocs-material>=9.6; extra == 'docs'
32
+ Requires-Dist: mkdocs>=1.6; extra == 'docs'
33
+ Requires-Dist: mkdocstrings[python]>=0.27; extra == 'docs'
34
+ Provides-Extra: stack
35
+ Requires-Dist: cosmic-moment>=0.1.0; extra == 'stack'
36
+ Requires-Dist: entropy-governance>=0.1.0; extra == 'stack'
37
+ Requires-Dist: entropy-table>=1.0.1; extra == 'stack'
38
+ Requires-Dist: fieldtheory>=0.1.0; extra == 'stack'
39
+ Requires-Dist: implosive-genesis>=0.4.0; extra == 'stack'
40
+ Requires-Dist: medium-modulation>=0.1.0; extra == 'stack'
41
+ Description-Content-Type: text/markdown
42
+
43
+ # sigillin
44
+
45
+ **The poetic-symbolic interface layer** – self-referential sigils that bind fieldtheory,
46
+ cosmic moments and entropy governance into living resonance.
47
+
48
+ [![CI](https://github.com/GenesisAeon/sigillin/actions/workflows/ci.yml/badge.svg)](https://github.com/GenesisAeon/sigillin/actions/workflows/ci.yml)
49
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org)
50
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
51
+ [![PyPI](https://img.shields.io/pypi/v/sigillin)](https://pypi.org/project/sigillin/)
52
+
53
+ ---
54
+
55
+ ## Install
56
+
57
+ ```bash
58
+ pip install sigillin
59
+ # or
60
+ uv add sigillin
61
+
62
+ # Full GenesisAeon stack integration
63
+ pip install sigillin[stack]
64
+ ```
65
+
66
+ ## Usage
67
+
68
+ ```bash
69
+ # Validate a sigil against the CREP schema
70
+ sig validate codex-sigil.yaml
71
+
72
+ # Render MandalaMap resonance spectrum
73
+ sig render cosmic-web.yaml
74
+
75
+ # Inspect sigil fields
76
+ sig inspect codex-sigil.yaml
77
+
78
+ # Create a self-referential provider bridge
79
+ sig bridge openai
80
+ ```
81
+
82
+ ## Sigil format (trilayer: YAML / JSON / Markdown)
83
+
84
+ Sigillin accepts three source formats:
85
+
86
+ ```yaml
87
+ # codex-sigil.yaml
88
+ coherence: 0.97
89
+ resonance: 0.88
90
+ emergence: 0.92
91
+ poetics: "The first sigil – carrier of the primal pattern."
92
+ ```
93
+
94
+ ```json
95
+ { "coherence": 0.97, "resonance": 0.88, "emergence": 0.92, "poetics": "..." }
96
+ ```
97
+
98
+ ```markdown
99
+ ---
100
+ coherence: 0.97
101
+ resonance: 0.88
102
+ emergence: 0.92
103
+ poetics: "The first sigil – carrier of the primal pattern."
104
+ ---
105
+ # Codex Prime
106
+
107
+ Full narrative description here.
108
+ ```
109
+
110
+ ## CREP validation
111
+
112
+ Every sigil is validated against four pillars:
113
+
114
+ | Key | Meaning |
115
+ |---|---|
116
+ | `coherence` | Internal self-consistency |
117
+ | `resonance` | Harmonic alignment with the field |
118
+ | `emergence` | Capacity for novel pattern generation |
119
+ | `poetics` | Narrative / symbolic intent |
120
+
121
+ ```python
122
+ from sigillin import Sigil
123
+
124
+ sigil = Sigil("codex-sigil.yaml")
125
+ sigil.validate_crep() # True / False
126
+ sigil.assert_crep() # raises SigilValidationError if invalid
127
+ ```
128
+
129
+ ## MandalaMap resonance
130
+
131
+ ```python
132
+ spectrum = sigil.render_mandala(depth=0.618) # φ-scaled resonance array
133
+ print(f"Peak: {spectrum.max():.4f}")
134
+ ```
135
+
136
+ ## Stack integration
137
+
138
+ With `pip install sigillin[stack]`, sigillin binds directly to the full GenesisAeon stack:
139
+
140
+ ```python
141
+ sigil.bind_to_field() # returns Lagrangian string from fieldtheory
142
+ ```
143
+
144
+ ```python
145
+ from sigillin.entropy_table_bridge import export_to_entropy_table
146
+ export_to_entropy_table("codex-sigil.yaml")
147
+ ```
148
+
149
+ ## Python API
150
+
151
+ ```python
152
+ from sigillin import Sigil
153
+
154
+ sigil = Sigil("codex-sigil.yaml")
155
+ print(sigil["coherence"]) # 0.97
156
+ print(sigil.get("tags", [])) # []
157
+ print(repr(sigil)) # Sigil(path=..., crep_valid=True)
158
+ ```
159
+
160
+ ---
161
+
162
+ Built with [uv](https://docs.astral.sh/uv/) · [Typer](https://typer.tiangolo.com/) ·
163
+ [Rich](https://rich.readthedocs.io/) · [NumPy](https://numpy.org/)
@@ -0,0 +1,9 @@
1
+ sigillin/__init__.py,sha256=ozfIzO4lm3iTbieb_cGe4dZtqp7DwAZhrg4zXBgsJhQ,155
2
+ sigillin/cli.py,sha256=jZEq7czcsxiXCHTQpH5h8bwfM_XliWb3l8Ir-emIUxE,2962
3
+ sigillin/core.py,sha256=lTe8b-dfDvrF3Pj5tutKCv2669WIOBEtDpmoJni2o3k,4816
4
+ sigillin/entropy_table_bridge.py,sha256=epZmwzpezuxl8LRJBwGC9CfH1pMMBKh0aenrjxBSMXM,1628
5
+ sigillin-0.1.0.dist-info/METADATA,sha256=J4zvUYj9z4sxEfumXqG_4jxKWnqfpZBB5X_gErogjhA,4677
6
+ sigillin-0.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
7
+ sigillin-0.1.0.dist-info/entry_points.txt,sha256=oAjYRRsx0ExRcOmqzhJDaI5W_fWRYEjLpVkRhujxnuU,41
8
+ sigillin-0.1.0.dist-info/licenses/LICENSE,sha256=wSqMUOfr3YalZyMoR93_W327v9D9Z0BeOg5-DFn4g1g,1090
9
+ sigillin-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ sig = sigillin.cli:app
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 JohannRömer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.