renderplan 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.
renderplan/py.typed ADDED
File without changes
renderplan/version.py ADDED
@@ -0,0 +1,13 @@
1
+ from __future__ import annotations
2
+
3
+ try:
4
+ from ._version import __version__
5
+ except ImportError: # source tree before setuptools-scm generated the module
6
+ try:
7
+ from importlib.metadata import PackageNotFoundError, version
8
+
9
+ __version__ = version("renderplan")
10
+ except PackageNotFoundError: # pragma: no cover - local source tree fallback
11
+ __version__ = "0.0.dev0"
12
+
13
+ __all__ = ["__version__"]
@@ -0,0 +1,160 @@
1
+ Metadata-Version: 2.4
2
+ Name: renderplan
3
+ Version: 0.1.0
4
+ Summary: Engine-neutral render profile, render plan, preflight, and render manifest contracts for speech pipelines.
5
+ Classifier: Development Status :: 3 - Alpha
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Programming Language :: Python :: 3.10
8
+ Classifier: Programming Language :: Python :: 3.11
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Classifier: Programming Language :: Python :: 3.14
12
+ Classifier: Typing :: Typed
13
+ Requires-Python: >=3.10
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: tomli>=2.0; python_version < "3.11"
17
+ Provides-Extra: dev
18
+ Requires-Dist: build>=1.2; extra == "dev"
19
+ Requires-Dist: pytest>=8; extra == "dev"
20
+ Requires-Dist: ruff>=0.8; extra == "dev"
21
+ Requires-Dist: mypy>=1.13; extra == "dev"
22
+ Dynamic: license-file
23
+
24
+ # renderplan MVP
25
+
26
+ `renderplan` is a deliberately small Python contract package shared by **UtterPlan**, **VoiceRender**, and **AudioCompose**. It contains no SSMD compiler, NLP, TTS engine, G2P, waveform, DSP, or orchestration implementation.
27
+
28
+ The intended dependency graph is:
29
+
30
+ ```text
31
+ utterplan ──────┐
32
+ voicerender ────┼──> renderplan
33
+ audiocompose ──┘
34
+ ```
35
+
36
+ The applications do not depend on each other; the contract package is their only shared dependency.
37
+
38
+ ## Contracts
39
+
40
+ The package defines four TOML documents:
41
+
42
+ 1. `renderprofile.toml` — seeded by VoiceRender and user-owned. It contains opaque, self-contained renderer bindings, portable requirements, optional capacity descriptions, split/fallback policy, and explicit pause durations. Shared pause modes are `manual` and `none`; orchestration pass limits do not belong in this contract.
43
+ 2. `renderplan.toml` — produced by UtterPlan. Its ordered flow is the exact serial execution contract: numbered speech requests, exact `NNNNNN.wav` names, generic pauses, audio items, controls, tokens, source provenance, and role bindings copied from the profile.
44
+ 3. `renderplan-preflight.toml` — produced by VoiceRender for one exact RenderPlan. It has status `ok`, `replan`, or `reject` and refers to speech occurrences by `(segment_number, segment_id)`.
45
+ 4. `render-manifest.toml` — produced by VoiceRender. It binds WAV metadata to exact `(segment_number, segment_id)` plan occurrences. A complete manifest contains exactly every plan speech occurrence; an incomplete one may contain only occurrences from that plan.
46
+
47
+ Consumers can use the shared joins instead of implementing their own parsers:
48
+
49
+ ```python
50
+ plan.validate_against_profile(profile)
51
+ report.validate_against(plan)
52
+ manifest.validate_against(plan)
53
+ ```
54
+
55
+ These are portable contract checks only; they do not resolve engines, inspect WAV files, or orchestrate a pipeline.
56
+
57
+ ## UtterPlan v7 source and token mapping
58
+
59
+ The first producer uses zero-based v7 provenance locators such as `f000000.s000`, `f000000.s001`, and `f000001.s000`: six digits for the flow index and three for the segment index. A locator is an opaque provenance address, meaningful only together with `RenderPlan.source_plan_id`; it is not a globally stable segment ID. `renderplan` does not parse or resolve locators and has no UtterPlan dependency.
60
+
61
+ `SourceSpan.start` and `.end` are Python string/code-point offsets into the prepared `FlowSegment.text`. For every speech request, UtterPlan must prove:
62
+
63
+ ```text
64
+ SpeechItem.text == concatenation, in order, of each referenced FlowSegment.text[start:end]
65
+ ```
66
+
67
+ Do not trim request-edge whitespace. These offsets also map source spans and request-local controls/tokens deterministically. Source-to-text equality is proved by UtterPlan against its source document, not by `renderplan`.
68
+ The destination start offset of source span `N` inside the request is the sum of the lengths of all preceding source slices. This preserves a direct mapping without trimming or a second offset table.
69
+
70
+ `TokenBundle.span` is a dense, ordered list of request-local `[start, end]` character ranges; `pos` and `tag`, when present, are dense parallel arrays. `lemma` and `morph` are sparse arrays of `[token_index, value]`. VoiceRender derives a token surface from `speech.text[start:end]`. Profile-required token fields must be complete under those semantics; available optional fields should be preserved, but `lemma` and `morph` should not be declared required unless an adapter genuinely requires them.
71
+
72
+ `SpeechControl` is request-local and renderer-neutral: it carries `start`, `end`, `name`, and TOML-safe `params`. Initial semantic names include `pronunciation`, `prosody`, `emphasis`, `say_as`, and `extension:<name>`. Controls participate in `segment_id`; renderers decide support, and unsupported controls must fail preflight rather than be ignored. Control ranges may overlap only when the source semantics permit it. Engine-specific voice selection is resolved into the opaque logical role/binding; audio directives become `AudioItem`s.
73
+
74
+ Bindings copied into plans must be self-contained enough to execute without reopening the RenderProfile. This contract does not define renderer-specific path keys or local-asset resolution.
75
+ This schema has no generic asset-reference type yet. A VoiceRender profile producer must refuse bindings that depend on profile-local or otherwise uncopied asset state; do not introduce renderer-specific asset-path keys into this shared contract.
76
+
77
+ ## Identity and replan contract
78
+
79
+ `segment_id` identifies the exact synthesis request: text, language, role, binding, tokens, and controls. It excludes display number and plan provenance such as source spans, split reason, planning level, and semantic end. Duplicate requests may therefore share a `segment_id`; `(segment_number, segment_id)` identifies each occurrence within a plan, report, or manifest.
80
+
81
+ `plan_id` identifies the complete ordered execution flow, including speech numbers/order, request IDs, provenance and planning semantics, preflight requirements, every pause, and every audio item. Producer package versions do not change semantic profile or plan identity. Exact source-file bytes are not included in RenderPlan identity.
82
+
83
+ A PreflightReport describes failures only for its concrete RenderPlan; it cannot preserve successful capacity splits from earlier attempts. The replan join is therefore:
84
+
85
+ ```text
86
+ original UtterPlan + RenderProfile + previous RenderPlan
87
+ + PreflightReport for that previous RenderPlan
88
+ -> new RenderPlan
89
+ ```
90
+
91
+ UtterPlan uses the previous plan as the partition baseline and rebuilds only failed source ranges. Each replan request must correspond to a `too_long` check and exactly match that speech occurrence's source coverage and current planning level. VoiceRender preflight never edits the plan. `replan` is only for recoverable capacity failures; missing engines, unknown voices, unsupported controls, invalid token fields, and frontend/API failures are `reject` conditions.
92
+
93
+ A `PauseItem` is a generic serial event positioned by `flow`, with duration, reason, and optional provenance; it can lead a flow or follow speech, audio, or another operation. No preceding speech number is required. The ordered flow is authoritative for AudioCompose.
94
+
95
+ ## Example preflight occurrence
96
+
97
+ ```toml
98
+ [[checks]]
99
+ segment_number = 37
100
+ segment_id = "sha256:..."
101
+ status = "too_long"
102
+ metric = "model_tokens"
103
+ measured = 532
104
+ maximum = 510
105
+ source = "pykokoro.prepare"
106
+
107
+ [[replan]]
108
+ segment_number = 37
109
+ segment_id = "sha256:..."
110
+ current_level = "sentence"
111
+ action = "split"
112
+ reason = "capacity"
113
+ metric = "model_tokens"
114
+ measured = 532
115
+ maximum = 510
116
+
117
+ [[replan.source]]
118
+ locator = "f000123.s004"
119
+ start = 0
120
+ end = 42
121
+ ```
122
+
123
+ UtterPlan does not need to understand `model_tokens`; the source-plan ID, copied profile ID, exact plan ID, source ranges, and generic split level/action allow stale feedback to be rejected without importing VoiceRender.
124
+
125
+ ## Install for development
126
+
127
+ This repository intentionally has **no `src/` directory**.
128
+
129
+ ```bash
130
+ python -m pip install -e '.[dev]'
131
+ pytest
132
+ ruff check .
133
+ mypy renderplan
134
+ ```
135
+
136
+ Versioning is dynamic through `setuptools-scm`; create Git tags such as `v0.1.0`. A source tree without Git metadata uses the configured development fallback version.
137
+
138
+ ## Example API
139
+
140
+ ```python
141
+ from renderplan import load_plan, load_preflight
142
+
143
+ plan = load_plan("chapter.renderplan.toml")
144
+ report = load_preflight("chapter.preflight.toml")
145
+
146
+ report.validate_against(plan)
147
+ if report.status == "replan":
148
+ for request in report.replan:
149
+ print(request.segment_number, request.action, request.source)
150
+ ```
151
+
152
+ ## MVP invariants
153
+
154
+ - Persisted identities are SHA-256 over canonical semantic payloads; producer versions are provenance, not identity.
155
+ - Speech numbers are contiguous starting at 1; speech `N` maps to `NNNNNN.wav`.
156
+ - Speech-request identity is stable across renumbering; full plan identity changes when flow order or execution semantics change.
157
+ - `RenderPlan.validate_against_profile`, `PreflightReport.validate_against`, and `RenderManifest.validate_against` enforce portable joins and exact occurrence matching.
158
+ - VoiceRender preflight never changes the plan, and rendering never introduces unplanned speech segments.
159
+ - AudioCompose consumes RenderPlan flow and RenderManifest artifacts; it does not reconstruct pauses from UtterPlan.
160
+ - Engine-specific binding tables are opaque to UtterPlan and AudioCompose.
@@ -0,0 +1,17 @@
1
+ renderplan/__init__.py,sha256=Z72jU6HSLWgCDwYuBCSVWPhwW_j5wRP5WKMgdoJ6TfU,1476
2
+ renderplan/__main__.py,sha256=k1ocEWawweo1qCJWNFAAvyxz3tcY13dzvCenHszij30,48
3
+ renderplan/_toml.py,sha256=5W6Q3S_ziw_KnE9yQdjcqPnfZQ22_0onoWTZFt7Etqg,2489
4
+ renderplan/_version.py,sha256=-Rr288b4YulcjDfbRh3DEiXUc5JmL7dsYakSJINWxLM,528
5
+ renderplan/cli.py,sha256=f_r7eeUetQULfyZSG0U9I79aVitjEPu1e33x6iRjIj4,2534
6
+ renderplan/codec.py,sha256=vT-9O4L8OlHdH4FaslHnidSn-pxPsV5JgFU9FC4asCs,24954
7
+ renderplan/errors.py,sha256=BTkiVprpPxng8xTnY_Y3SfTDSl-COHJX_AS5EiyPlYs,293
8
+ renderplan/identity.py,sha256=eaPzOg1tnz3JJ7CwX05x_0E_FU4VQM5a_WDX1wlCBDA,2809
9
+ renderplan/model.py,sha256=9JVNOLdzDSOqst2izaEhkog-0U_pCYdj3VYLLLfQu1Q,37600
10
+ renderplan/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ renderplan/version.py,sha256=IzDi8ICwAkCIEAkLEWx-K3-N7lcU_YB_nClnXM1UInI,422
12
+ renderplan-0.1.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
13
+ renderplan-0.1.0.dist-info/METADATA,sha256=XmOo0vueTXGAim9lcxtqt0g4CYl10N-QdhXi8LzRTCk,9421
14
+ renderplan-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
15
+ renderplan-0.1.0.dist-info/entry_points.txt,sha256=kTbANKPjHGMlrlp9cKq2v0W7K9G-HpHKdKQiwcWa9HA,51
16
+ renderplan-0.1.0.dist-info/top_level.txt,sha256=NL_rJqLd91jX20UlU9zknE65JJLajN0sz4qUJ9NxG6o,11
17
+ renderplan-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ renderplan = renderplan.cli:main
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1 @@
1
+ renderplan