compono 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.
compono/__init__.py ADDED
@@ -0,0 +1,45 @@
1
+ """compono — agent-oriented, code-based PPTX generation library.
2
+
3
+ Public exports ONLY (COMPONO_PLAN.md section 10) — resolver/validator/template
4
+ loader stay internal, reached only through render_deck/validate.
5
+ """
6
+
7
+ from compono.render import (
8
+ DeckValidationError,
9
+ RenderReport,
10
+ ValidationReport,
11
+ render_deck,
12
+ validate,
13
+ )
14
+ from compono.schema import (
15
+ Chart,
16
+ Deck,
17
+ Grid,
18
+ Header,
19
+ Image,
20
+ Sequence,
21
+ Shape,
22
+ Slide,
23
+ Stat,
24
+ Table,
25
+ Text,
26
+ )
27
+
28
+ __all__ = [
29
+ "Chart",
30
+ "Deck",
31
+ "DeckValidationError",
32
+ "Grid",
33
+ "Header",
34
+ "Image",
35
+ "RenderReport",
36
+ "Sequence",
37
+ "Shape",
38
+ "Slide",
39
+ "Stat",
40
+ "Table",
41
+ "Text",
42
+ "ValidationReport",
43
+ "render_deck",
44
+ "validate",
45
+ ]
compono/cli.py ADDED
@@ -0,0 +1,70 @@
1
+ """Console-script entry point mirroring the render_deck/validate verbs.
2
+
3
+ compono validate spec.json
4
+ compono render spec.json --template fractal -o deck.pptx
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import argparse
10
+ import json
11
+ import sys
12
+ from pathlib import Path
13
+
14
+ from compono.render import DeckValidationError, render_deck, validate
15
+
16
+
17
+ def _load_spec(path: str) -> dict:
18
+ return json.loads(Path(path).read_text(encoding="utf-8"))
19
+
20
+
21
+ def main(argv: list[str] | None = None) -> int:
22
+ parser = argparse.ArgumentParser(prog="compono")
23
+ subparsers = parser.add_subparsers(dest="command", required=True)
24
+
25
+ validate_parser = subparsers.add_parser("validate", help="Validate a deck spec without rendering.")
26
+ validate_parser.add_argument("spec", help="Path to a JSON deck spec.")
27
+
28
+ render_parser = subparsers.add_parser("render", help="Render a deck spec to a .pptx file.")
29
+ render_parser.add_argument("spec", help="Path to a JSON deck spec.")
30
+ render_parser.add_argument("-o", "--output", default="deck.pptx", help="Output .pptx path.")
31
+ render_parser.add_argument(
32
+ "--template", default=None, help="Template name (reserved; the default template is used for now)."
33
+ )
34
+
35
+ args = parser.parse_args(argv)
36
+
37
+ if args.command == "validate":
38
+ spec = _load_spec(args.spec)
39
+ validation_report = validate(spec)
40
+ print(
41
+ json.dumps(
42
+ {
43
+ "valid": validation_report.valid,
44
+ "errors": validation_report.errors,
45
+ "warnings": validation_report.warnings,
46
+ },
47
+ indent=2,
48
+ )
49
+ )
50
+ return 0 if validation_report.valid else 1
51
+
52
+ if args.command == "render":
53
+ spec = _load_spec(args.spec)
54
+ try:
55
+ render_report = render_deck(spec, args.output)
56
+ except DeckValidationError as exc:
57
+ print(json.dumps({"valid": False, "errors": exc.errors}, indent=2), file=sys.stderr)
58
+ return 1
59
+ print(
60
+ json.dumps(
61
+ {"pptx_path": str(render_report.pptx_path), "warnings": render_report.warnings}, indent=2
62
+ )
63
+ )
64
+ return 0
65
+
66
+ return 1
67
+
68
+
69
+ if __name__ == "__main__":
70
+ raise SystemExit(main())
compono/fonts/.gitkeep ADDED
File without changes
compono/primitives.py ADDED
@@ -0,0 +1,5 @@
1
+ """Typed builder classes (human path). Pure sugar over the pydantic schema in schema.py.
2
+
3
+ Serializes to the identical dict shape the agent path (raw JSON/dict) uses —
4
+ see COMPONO_PLAN.md section 9. Populated starting Step 1.
5
+ """
compono/py.typed ADDED
File without changes