vyral 0.1.1__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.
Files changed (102) hide show
  1. vyral-0.1.1.dist-info/METADATA +605 -0
  2. vyral-0.1.1.dist-info/RECORD +102 -0
  3. vyral-0.1.1.dist-info/WHEEL +4 -0
  4. vyral-0.1.1.dist-info/entry_points.txt +3 -0
  5. vyral-0.1.1.dist-info/licenses/LICENSE +173 -0
  6. vyral_runtime/__init__.py +626 -0
  7. vyral_runtime/__main__.py +4 -0
  8. vyral_runtime/_conformance/__init__.py +1 -0
  9. vyral_runtime/_conformance/runtime/v1/manifest.json +100 -0
  10. vyral_runtime/_conformance/runtime/v1/manifest.schema.json +107 -0
  11. vyral_runtime/_conformance/runtime/v1/scenario.schema.json +114 -0
  12. vyral_runtime/_conformance/runtime/v1/scenarios/canonical/strong-profile.json +467 -0
  13. vyral_runtime/_conformance/runtime/v1/scenarios/execution/native-lifecycle.json +224 -0
  14. vyral_runtime/_conformance/runtime/v1/scenarios/external-workers/handler-lifecycle.json +86 -0
  15. vyral_runtime/_conformance/runtime/v1/scenarios/goldens/admission-receipts.json +105 -0
  16. vyral_runtime/_conformance/runtime/v1/scenarios/goldens/collection-snapshot-hash.json +78 -0
  17. vyral_runtime/_conformance/runtime/v1/scenarios/goldens/embedding-vectors.json +44 -0
  18. vyral_runtime/_conformance/runtime/v1/scenarios/goldens/graph-record-mapping.json +308 -0
  19. vyral_runtime/_conformance/runtime/v1/scenarios/goldens/primitives-hashing.json +51 -0
  20. vyral_runtime/_conformance/runtime/v1/scenarios/goldens/rag-ingestion-plan.json +94 -0
  21. vyral_runtime/_conformance/runtime/v1/scenarios/records/core-crud.json +462 -0
  22. vyral_runtime/_conformance/runtime/v1/scenarios/records/query-semantics.json +200 -0
  23. vyral_runtime/_contracts/__init__.py +1 -0
  24. vyral_runtime/_contracts/public-sdk-surface.json +3966 -0
  25. vyral_runtime/_contracts/vyral-public.schema.json +13307 -0
  26. vyral_runtime/_contracts/vyral.openapi.json +18456 -0
  27. vyral_runtime/_datetime.py +34 -0
  28. vyral_runtime/_local_experience.py +552 -0
  29. vyral_runtime/_starter.py +187 -0
  30. vyral_runtime/_version.py +5 -0
  31. vyral_runtime/admission.py +137 -0
  32. vyral_runtime/async_runtime.py +86 -0
  33. vyral_runtime/canonical/__init__.py +129 -0
  34. vyral_runtime/canonical/codec.py +1096 -0
  35. vyral_runtime/canonical/conformance.py +643 -0
  36. vyral_runtime/canonical/models.py +1511 -0
  37. vyral_runtime/canonical/store.py +2172 -0
  38. vyral_runtime/conformance.py +576 -0
  39. vyral_runtime/contracts.py +221 -0
  40. vyral_runtime/embeddings/__init__.py +45 -0
  41. vyral_runtime/embeddings/models.py +212 -0
  42. vyral_runtime/embeddings/providers.py +284 -0
  43. vyral_runtime/embeddings/service.py +174 -0
  44. vyral_runtime/execution/__init__.py +173 -0
  45. vyral_runtime/execution/authoring.py +113 -0
  46. vyral_runtime/execution/conformance.py +342 -0
  47. vyral_runtime/execution/harness.py +601 -0
  48. vyral_runtime/execution/http.py +541 -0
  49. vyral_runtime/execution/jobs.py +552 -0
  50. vyral_runtime/execution/local_runtime.py +3011 -0
  51. vyral_runtime/execution/models.py +1037 -0
  52. vyral_runtime/execution/native_conformance.py +586 -0
  53. vyral_runtime/execution/native_models.py +652 -0
  54. vyral_runtime/execution/worker.py +609 -0
  55. vyral_runtime/graph/__init__.py +93 -0
  56. vyral_runtime/graph/mapper.py +290 -0
  57. vyral_runtime/graph/models.py +435 -0
  58. vyral_runtime/graph/operations.py +456 -0
  59. vyral_runtime/graph/providers.py +82 -0
  60. vyral_runtime/graph/service.py +1034 -0
  61. vyral_runtime/host/__init__.py +39 -0
  62. vyral_runtime/host/__main__.py +4 -0
  63. vyral_runtime/host/application.py +219 -0
  64. vyral_runtime/host/auth.py +120 -0
  65. vyral_runtime/host/cli.py +468 -0
  66. vyral_runtime/host/diagnostics.py +73 -0
  67. vyral_runtime/host/mcp.py +3247 -0
  68. vyral_runtime/host/rest.py +706 -0
  69. vyral_runtime/host/rest_operations.py +2218 -0
  70. vyral_runtime/host/rest_registry.py +234 -0
  71. vyral_runtime/integrations/__init__.py +57 -0
  72. vyral_runtime/integrations/extropic.py +1201 -0
  73. vyral_runtime/integrations/ripgrep.py +562 -0
  74. vyral_runtime/local/__init__.py +141 -0
  75. vyral_runtime/local/async_store.py +180 -0
  76. vyral_runtime/local/conformance.py +335 -0
  77. vyral_runtime/local/lexical.py +755 -0
  78. vyral_runtime/local/models.py +421 -0
  79. vyral_runtime/local/object_store.py +793 -0
  80. vyral_runtime/local/query_engine.py +427 -0
  81. vyral_runtime/local/query_models.py +394 -0
  82. vyral_runtime/local/record_store.py +1575 -0
  83. vyral_runtime/local/snapshots.py +416 -0
  84. vyral_runtime/local/trace_store.py +721 -0
  85. vyral_runtime/primitives.py +31 -0
  86. vyral_runtime/profiles.py +143 -0
  87. vyral_runtime/py.typed +1 -0
  88. vyral_runtime/rag/__init__.py +91 -0
  89. vyral_runtime/rag/context.py +1849 -0
  90. vyral_runtime/rag/context_models.py +629 -0
  91. vyral_runtime/rag/evaluation_models.py +249 -0
  92. vyral_runtime/rag/ingestion.py +1817 -0
  93. vyral_runtime/rag/models.py +485 -0
  94. vyral_runtime/readiness.py +187 -0
  95. vyral_runtime/retrieval/__init__.py +84 -0
  96. vyral_runtime/retrieval/evaluation.py +826 -0
  97. vyral_runtime/retrieval/evaluation_models.py +502 -0
  98. vyral_runtime/retrieval/models.py +435 -0
  99. vyral_runtime/retrieval/profiles.py +288 -0
  100. vyral_runtime/retrieval/service.py +990 -0
  101. vyral_runtime/runtime.py +611 -0
  102. vyral_runtime/storage.py +212 -0
@@ -0,0 +1,605 @@
1
+ Metadata-Version: 2.5
2
+ Name: vyral
3
+ Version: 0.1.1
4
+ Summary: Python-first local runtime for the portable Vyral contract
5
+ Project-URL: Homepage, https://github.com/univeracity/vyral
6
+ Project-URL: Repository, https://github.com/univeracity/vyral
7
+ Project-URL: Issues, https://github.com/univeracity/vyral/issues
8
+ Author: Jeremy Dixon
9
+ License: Apache License
10
+ Version 2.0, January 2004
11
+ http://www.apache.org/licenses/
12
+
13
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
14
+
15
+ 1. Definitions.
16
+
17
+ "License" shall mean the terms and conditions for use, reproduction, and
18
+ distribution as defined by Sections 1 through 9 of this document.
19
+
20
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
21
+ owner that is granting the License.
22
+
23
+ "Legal Entity" shall mean the union of the acting entity and all other entities
24
+ that control, are controlled by, or are under common control with that entity.
25
+ For the purposes of this definition, "control" means (i) the power, direct or
26
+ indirect, to cause the direction or management of such entity, whether by
27
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
28
+ outstanding shares, or (iii) beneficial ownership of such entity.
29
+
30
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
31
+ permissions granted by this License.
32
+
33
+ "Source" form shall mean the preferred form for making modifications, including
34
+ but not limited to software source code, documentation source, and configuration
35
+ files.
36
+
37
+ "Object" form shall mean any form resulting from mechanical transformation or
38
+ translation of a Source form, including but not limited to compiled object code,
39
+ generated documentation, and conversions to other media types.
40
+
41
+ "Work" shall mean the work of authorship, whether in Source or Object form,
42
+ made available under the License, as indicated by a copyright notice that is
43
+ included in or attached to the work (an example is provided in the Appendix
44
+ below).
45
+
46
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
47
+ is based on (or derived from) the Work and for which the editorial revisions,
48
+ annotations, elaborations, or other modifications represent, as a whole, an
49
+ original work of authorship. For the purposes of this License, Derivative Works
50
+ shall not include works that remain separable from, or merely link (or bind by
51
+ name) to the interfaces of, the Work and Derivative Works thereof.
52
+
53
+ "Contribution" shall mean any work of authorship, including the original
54
+ version of the Work and any modifications or additions to that Work or
55
+ Derivative Works thereof, that is intentionally submitted to Licensor for
56
+ inclusion in the Work by the copyright owner or by an individual or Legal Entity
57
+ authorized to submit on behalf of the copyright owner. For the purposes of this
58
+ definition, "submitted" means any form of electronic, verbal, or written
59
+ communication sent to the Licensor or its representatives, including but not
60
+ limited to communication on electronic mailing lists, source code control
61
+ systems, and issue tracking systems that are managed by, or on behalf of, the
62
+ Licensor for the purpose of discussing and improving the Work, but excluding
63
+ communication that is conspicuously marked or otherwise designated in writing by
64
+ the copyright owner as "Not a Contribution."
65
+
66
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
67
+ of whom a Contribution has been received by Licensor and subsequently
68
+ incorporated within the Work.
69
+
70
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
71
+ License, each Contributor hereby grants to You a perpetual, worldwide,
72
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
73
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
74
+ sublicense, and distribute the Work and such Derivative Works in Source or
75
+ Object form.
76
+
77
+ 3. Grant of Patent License. Subject to the terms and conditions of this License,
78
+ each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
79
+ no-charge, royalty-free, irrevocable (except as stated in this section) patent
80
+ license to make, have made, use, offer to sell, sell, import, and otherwise
81
+ transfer the Work, where such license applies only to those patent claims
82
+ licensable by such Contributor that are necessarily infringed by their
83
+ Contribution(s) alone or by combination of their Contribution(s) with the Work
84
+ to which such Contribution(s) was submitted. If You institute patent litigation
85
+ against any entity (including a cross-claim or counterclaim in a lawsuit)
86
+ alleging that the Work or a Contribution incorporated within the Work
87
+ constitutes direct or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate as of the date
89
+ such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
92
+ Derivative Works thereof in any medium, with or without modifications, and in
93
+ Source or Object form, provided that You meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or Derivative Works a copy of
96
+ this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices stating that
99
+ You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works that You
102
+ distribute, all copyright, patent, trademark, and attribution notices from the
103
+ Source form of the Work, excluding those notices that do not pertain to any part
104
+ of the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
107
+ any Derivative Works that You distribute must include a readable copy of the
108
+ attribution notices contained within such NOTICE file, excluding those notices
109
+ that do not pertain to any part of the Derivative Works, in at least one of the
110
+ following places: within a NOTICE text file distributed as part of the
111
+ Derivative Works; within the Source form or documentation, if provided along
112
+ with the Derivative Works; or, within a display generated by the Derivative
113
+ Works, if and wherever such third-party notices normally appear. The contents of
114
+ the NOTICE file are for informational purposes only and do not modify the
115
+ License. You may add Your own attribution notices within Derivative Works, alongside or as an
116
+ addendum to the NOTICE text from the Work, provided that such additional
117
+ attribution notices cannot be construed as modifying the License.
118
+
119
+ You may add Your own copyright statement to Your modifications and may provide
120
+ additional or different license terms and conditions for use, reproduction, or
121
+ distribution of Your modifications, or for any such Derivative Works as a whole,
122
+ provided Your use, reproduction, and distribution of the Work otherwise complies
123
+ with the conditions stated in this License.
124
+
125
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
126
+ Contribution intentionally submitted for inclusion in the Work by You to the
127
+ Licensor shall be under the terms and conditions of this License, without any
128
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
129
+ supersede or modify the terms of any separate license agreement you may have
130
+ executed with Licensor regarding such Contributions.
131
+
132
+ 6. Trademarks. This License does not grant permission to use the trade names,
133
+ trademarks, service marks, or product names of the Licensor, except as required
134
+ for reasonable and customary use in describing the origin of the Work and
135
+ reproducing the content of the NOTICE file.
136
+
137
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
138
+ writing, Licensor provides the Work (and each Contributor provides its
139
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
140
+ KIND, either express or implied, including, without limitation, any warranties or
141
+ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
142
+ PARTICULAR PURPOSE. You are solely responsible for determining the
143
+ appropriateness of using or redistributing the Work and assume any risks
144
+ associated with Your exercise of permissions under this License.
145
+
146
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
147
+ tort (including negligence), contract, or otherwise, unless required by
148
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
149
+ writing, shall any Contributor be liable to You for damages, including any
150
+ direct, indirect, special, incidental, or consequential damages of any character
151
+ arising as a result of this License or out of the use or inability to use the
152
+ Work (including but not limited to damages for loss of goodwill, work stoppage,
153
+ computer failure or malfunction, or any and all other commercial damages or
154
+ losses), even if such Contributor has been advised of the possibility of such
155
+ damages.
156
+
157
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
158
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
159
+ acceptance of support, warranty, indemnity, or other liability obligations
160
+ and/or rights consistent with this License. However, in accepting such
161
+ obligations, You may act only on Your own behalf and on Your sole
162
+ responsibility, not on behalf of any other Contributor, and only if You agree to
163
+ indemnify, defend, and hold each Contributor harmless for any liability incurred
164
+ by, or claims asserted against, such Contributor by reason of your accepting any
165
+ such warranty or additional liability.
166
+
167
+ END OF TERMS AND CONDITIONS
168
+
169
+ Copyright 2026 Jeremy Dixon
170
+
171
+ Licensed under the Apache License, Version 2.0 (the "License");
172
+ you may not use this file except in compliance with the License.
173
+ You may obtain a copy of the License at
174
+
175
+ http://www.apache.org/licenses/LICENSE-2.0
176
+
177
+ Unless required by applicable law or agreed to in writing, software
178
+ distributed under the License is distributed on an "AS IS" BASIS,
179
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
180
+ See the License for the specific language governing permissions and
181
+ limitations under the License.
182
+ License-File: LICENSE
183
+ Keywords: local-development,rag,retrieval,runtime,vyral
184
+ Classifier: Development Status :: 2 - Pre-Alpha
185
+ Classifier: Intended Audience :: Developers
186
+ Classifier: License :: OSI Approved :: Apache Software License
187
+ Classifier: Programming Language :: Python :: 3
188
+ Classifier: Programming Language :: Python :: 3.10
189
+ Classifier: Programming Language :: Python :: 3.11
190
+ Classifier: Programming Language :: Python :: 3.12
191
+ Classifier: Topic :: Database
192
+ Classifier: Topic :: Software Development :: Libraries
193
+ Requires-Python: >=3.10
194
+ Provides-Extra: dev
195
+ Requires-Dist: build<2,>=1.2; extra == 'dev'
196
+ Requires-Dist: coverage==7.15.4; extra == 'dev'
197
+ Requires-Dist: jsonschema<5,>=4.23; extra == 'dev'
198
+ Requires-Dist: mypy<3,>=1.18; extra == 'dev'
199
+ Provides-Extra: extropic
200
+ Requires-Dist: extro-sim<0.6,>=0.5; extra == 'extropic'
201
+ Provides-Extra: extropic-torx
202
+ Requires-Dist: extro-sim<0.6,>=0.5; extra == 'extropic-torx'
203
+ Requires-Dist: extro-torx==0.0.1; extra == 'extropic-torx'
204
+ Requires-Dist: jax<0.12,>=0.11; extra == 'extropic-torx'
205
+ Provides-Extra: server
206
+ Requires-Dist: uvicorn<1,>=0.30; extra == 'server'
207
+ Description-Content-Type: text/markdown
208
+
209
+ # vyral
210
+
211
+ Python-first implementation of Vyral's portable local runtime.
212
+
213
+ Current version: `0.1.1`
214
+
215
+ Current maturity: `prototype`
216
+
217
+ Supported Vyral contract: `0.3.0`
218
+
219
+ This package is implementing the sequence in
220
+ [`design/python-runtime.md`](../../design/python-runtime.md). The current
221
+ prototype includes:
222
+
223
+ - the canonical OpenAPI, JSON Schema, and public operation catalog;
224
+ - shared Python/.NET conformance fixtures for primitives, snapshots,
225
+ deterministic embeddings, record CRUD, compound filters, ordering,
226
+ continuation, RAG plan/manifest hashes, graph record mapping, and durable
227
+ execution failure/cancellation semantics;
228
+ - SQLite collections and records, filtering, lexical and exact-vector search,
229
+ snapshots, filesystem objects, and persisted traces;
230
+ - deterministic embedding providers, retrieval profiles and fusion, reranking
231
+ seams, ingestion, context and prompt assembly, citations, and evaluation;
232
+ - graph import/export, traversal, inspection, doctor, and bounded GraphRAG
233
+ context expansion;
234
+ - the strong transactional SQLite CanonicalStore profile with fences,
235
+ revisions, idempotency, outbox leasing, migrations, preflight, and
236
+ hash-verified archives;
237
+ - native durable execution with retries, cancellation, events, timers, waits,
238
+ leases, checkpoints, artifacts, restart recovery, maintenance, policy, and
239
+ thirteen built-in domain job adapters, including staged cross-store artifact ingestion and
240
+ receipt-bound collection lifecycle;
241
+ - an OpenAPI-derived ASGI host covering all 133 REST operation IDs;
242
+ - parity with the shared `vyral.admission.v1` contract: aggregate mutations return durable,
243
+ idempotent jobs with `Location`, while non-mutating RAG dry-runs remain synchronous;
244
+ - a stateless MCP `2026-07-28` endpoint with self-describing routing headers,
245
+ authorization, bounded resources/tools, and durable Tasks;
246
+ - synchronous APIs plus bounded-executor asynchronous facades; and
247
+ - Python-native handler descriptors, an async run context, a replayable local
248
+ handler harness, and a dependency-free token-safe HTTP external-worker
249
+ transport covering leases, heartbeats, progress, events, artifacts,
250
+ checkpoints, waits, completion, and cancellation.
251
+
252
+ Every required portable-local profile is implemented and reports
253
+ `available: true`. All remain `prototype`, and `fullLocalReady` deliberately
254
+ remains false pending independent security review and an explicit promotion
255
+ decision. The manual Python 3.10–3.12 Linux/macOS/Windows matrix now passes:
256
+ every cell builds and installs clean wheel and source artifacts, completes the
257
+ cited restart/replay quickstart, verifies the server extra, and contributes to
258
+ one consistent aggregate receipt. The combined `0.1.0` → `0.1.1`
259
+ upgrade/restart rehearsal and the executable adversarial security gate also
260
+ pass locally; automated evidence does not substitute for independent review.
261
+ Unsupported optional providers are disclosed explicitly; the runtime does not
262
+ silently delegate embedded behavior to .NET or to the existing HTTP client.
263
+
264
+ ## Local single-player experience
265
+
266
+ From the repository root, the shortest path runs directly from source:
267
+
268
+ ```bash
269
+ ./scripts/vyral
270
+ ```
271
+
272
+ It performs the connected retrieval-and-execution proof described below. No
273
+ installation or third-party service is required. Use `python scripts/vyral` on
274
+ Windows.
275
+
276
+ To install the command into an isolated environment instead:
277
+
278
+ ```bash
279
+ python3 -m venv .venv
280
+ . .venv/bin/activate
281
+ python -m pip install --editable runtimes/python
282
+ ```
283
+
284
+ The installed command is `vyral`, and running it without arguments performs the
285
+ same proof:
286
+
287
+ ```bash
288
+ vyral
289
+ ```
290
+
291
+ The quickstart creates a three-document, source-backed record corpus without
292
+ vectors, returns cited lexical context, admits a decorated handler with a
293
+ stable idempotency key,
294
+ closes the runtime before dispatch, reopens the same SQLite/filesystem state,
295
+ and completes the preserved run identity. It reports the queued receipt before
296
+ the close/reopen boundary so acceptance is not confused with completion.
297
+
298
+ The quickstart does not invoke an embedding provider. The runtime's available
299
+ default `local-token-hash` provider remains CPU-only, model-free, and requires
300
+ no network or downloaded assets; when explicitly selected for vector mechanics,
301
+ its lexical-overlap ranking is not a semantic-model quality claim.
302
+
303
+ Inspect the state and its material limitations independently:
304
+
305
+ ```bash
306
+ vyral inspect
307
+ ```
308
+
309
+ The quickstart records an ownership marker and will reset only a dedicated
310
+ directory bearing that marker:
311
+
312
+ ```bash
313
+ vyral quickstart --reset
314
+ ```
315
+
316
+ Generate one editable application when you are ready to own the code:
317
+
318
+ ```bash
319
+ vyral init
320
+ python ./vyral_app.py
321
+ ```
322
+
323
+ The generated file uses `@vyral(...)`, admits work with a stable idempotency
324
+ key, prints the durable receipt, closes the first runtime before dispatch,
325
+ reopens its own `.vyral/vyral_app` directory, and completes the preserved run.
326
+ Running it again reports `replayed=true` and dispatches no duplicate work. The
327
+ generator refuses to overwrite an existing path; the result is ordinary Python
328
+ source intended to be edited or absorbed into an application. Leave the visible
329
+ `RUN_VERSION` unchanged to prove replay, then increment it after changing the
330
+ work to admit a new run. Use `--path` or `--root` when you need non-default code
331
+ or state locations.
332
+
333
+ Use `--json` with `init`, `quickstart`, or `inspect` for machine-readable
334
+ output. `vyral-runtime` remains a compatibility command alias. No wheel has
335
+ yet been published, so direct source use or the editable install is the public
336
+ pre-release path. Once the authorized wheel is available, install it with
337
+ `python -m pip install vyral` without changing the local commands.
338
+
339
+ From a source checkout, run the generated application through the same launcher
340
+ that created it so no editable installation is required:
341
+
342
+ ```bash
343
+ ./scripts/vyral init
344
+ ./scripts/vyral run ./vyral_app.py
345
+ ```
346
+
347
+ After installation, the equivalent commands are `vyral init` and
348
+ `vyral run ./vyral_app.py`.
349
+
350
+ The quickstart JSON includes measured `firstCitationMs`, `durableReceiptMs`,
351
+ `restartRecoveryMs`, and `completedMs` milestones. Artifact qualification runs
352
+ the installed wheel and sdist through the generated editable application, its
353
+ idempotent rerun, the connected quickstart, a second-process quickstart replay,
354
+ independent inspection, and marker-bounded reset. Each supported platform cell
355
+ rejects either installed path if package installation through its first useful
356
+ result takes more than five minutes.
357
+
358
+ ```python
359
+ from vyral_runtime import VyralRuntime
360
+
361
+ runtime = VyralRuntime()
362
+ status = runtime.readiness().to_dict()
363
+
364
+ print(status["runtimeVersion"])
365
+ print(status["contract"]["operationCount"])
366
+ print(status["fullLocalReady"])
367
+ ```
368
+
369
+ ```python
370
+ from vyral_runtime import VyralRuntime
371
+
372
+ with VyralRuntime.open_local("./.vyral") as runtime:
373
+ runtime.records.create_collection({"name": "notes"})
374
+ runtime.records.upsert_record(
375
+ "notes",
376
+ {
377
+ "id": "hello",
378
+ "partitionKey": "local",
379
+ "content": {"text": "Hello from the Python runtime"},
380
+ },
381
+ )
382
+ ```
383
+
384
+ Python handlers use the same authoring surface in the local harness and over
385
+ the remote external-worker protocol. The decorator is deliberately thin: it
386
+ builds the existing portable descriptor and handler objects without adding a
387
+ workflow graph, scheduler, or alternate retry model.
388
+
389
+ ```python
390
+ from vyral_runtime import (
391
+ ExecutionRunContext,
392
+ ExecutionRunResult,
393
+ execution_plugin,
394
+ vyral,
395
+ )
396
+
397
+ @vyral(
398
+ "example.echo",
399
+ plugin="example.plugin",
400
+ max_attempts=3,
401
+ )
402
+ async def echo(context: ExecutionRunContext) -> ExecutionRunResult:
403
+ await context.record_event("log", message="handler started")
404
+ return ExecutionRunResult.succeeded_result({"received": context.run.payload})
405
+
406
+ plugin = execution_plugin(
407
+ "example.plugin",
408
+ name="Example",
409
+ version="1.0.0",
410
+ handlers=(echo,),
411
+ )
412
+ ```
413
+
414
+ The decorated handler remains directly awaitable for focused tests. Explicit
415
+ `execution_handler(...)`, `DelegateExecutionHandler`, and
416
+ `StaticExecutionPlugin` construction remains available when descriptor-oriented
417
+ naming or dynamic registration is clearer. Handler and plugin IDs remain
418
+ explicit because they are durable contract identities; renaming or moving a
419
+ Python function must not silently create a different operation.
420
+
421
+ ### Experimental source-native retrieval
422
+
423
+ `vyral_runtime.integrations.ripgrep` provides a bounded, read-only experiment
424
+ for code, Markdown, and other safely accessible text sources. It uses a static
425
+ root and glob allowlist, fixed-string queries over standard input, source
426
+ revision citations, and strict resource limits. It is not part of the stable
427
+ wire contract and is not automatically exposed through REST or MCP. Retained
428
+ comparison evidence supports it for exact identifiers and phrases in current
429
+ local sources when maintaining a duplicate index is not worthwhile. Use Vyral
430
+ lexical retrieval for reordered terms, prefixes, record filters, tenant
431
+ boundaries, snapshots, and lower post-index query latency. See the
432
+ [source-native retrieval guide](../../docs/guides/source-native-retrieval.md)
433
+ and [comparison receipt](../../benchmarks/retrieval/README.md).
434
+
435
+ ### Experimental Extropic execution
436
+
437
+ Install the optional `extropic` extra to place a registered Python workload
438
+ behind the same Vyral execution lifecycle:
439
+
440
+ ```bash
441
+ python -m pip install --editable "runtimes/python[extropic]"
442
+ ```
443
+
444
+ ```python
445
+ from vyral_runtime import ExecutionRunContext, ExecutionRunResult, vyral
446
+ from vyral_runtime.integrations.extropic import (
447
+ ExtropicAdapterOptions,
448
+ ExtropicExecutionAdapter,
449
+ )
450
+
451
+
452
+ def simulate(payload):
453
+ return {"seed": payload["seed"], "samples": payload["samples"]}
454
+
455
+
456
+ extropic = ExtropicExecutionAdapter(
457
+ "example.simulation.v1",
458
+ simulate,
459
+ options=ExtropicAdapterOptions(tier="l4", require_seed=True),
460
+ )
461
+
462
+
463
+ @vyral("example.simulate", plugin="example.extropic", max_attempts=3)
464
+ async def run_simulation(
465
+ context: ExecutionRunContext,
466
+ ) -> ExecutionRunResult:
467
+ return await extropic.execute(context)
468
+ ```
469
+
470
+ Vyral retains the provider job id, safe status, bounded logs, and replay state;
471
+ it never persists Extropic credentials or upload grants. Because Extropic 0.5
472
+ does not accept an idempotency key during job creation, a lost create response
473
+ fails closed and is not resubmitted automatically. Known provider jobs are
474
+ reconnected and retried by id. The integration is a prototype, remains outside
475
+ the adapter qualification matrix, and makes no Z1 support claim. Registered
476
+ workloads should be self-contained plain Python functions; Vyral serializes
477
+ those functions by value, while third-party imports must exist in Extropic's
478
+ sandbox. A pinned `extropic-torx` extra and
479
+ [`examples/python/extropic_torx_workload.py`](../../examples/python/extropic_torx_workload.py)
480
+ provide a real, credit-free Torx packaging proof on Python 3.11 or newer. See the
481
+ [Extropic execution guide](../../docs/guides/extropic-execution.md) for the
482
+ complete lifecycle and current boundaries.
483
+
484
+ ## Choosing a Python package
485
+
486
+ | Goal | Install |
487
+ | --- | --- |
488
+ | Talk to a running .NET or Python Vyral host | `vyral-client` |
489
+ | Run Vyral in-process without a server or .NET | `vyral` |
490
+ | Run a Python-hosted REST and MCP endpoint | `vyral[server]` |
491
+ | Rehearse the current Extropic/Torx proof locally | `vyral[extropic-torx]` (Python 3.11+) |
492
+
493
+ The existing `vyral-client` distribution remains the supported lightweight
494
+ client for a running Vyral server. `vyral` is a separate runtime distribution
495
+ and does not depend on or route its embedded behavior through that client.
496
+
497
+ ## Embedded models and wire JSON
498
+
499
+ The embedded runtime accepts schema-shaped mappings where convenient, then
500
+ returns rich Python models such as `VyralRecord`, readiness receipts, plans,
501
+ and execution state. Use their `to_dict()` methods when serializing to JSON or
502
+ crossing an HTTP, MCP, queue, or persistence boundary. The REST host and
503
+ `vyral-client` expose the canonical JSON wire representation instead; callers
504
+ must not depend on Python class names or private object layout as portable
505
+ contract.
506
+
507
+ OpenAPI operation IDs remain the semantic naming authority. Embedded methods
508
+ use idiomatic `snake_case` names and mirror those operation IDs where practical;
509
+ a convenience name may improve Python composition but cannot add alternate
510
+ wire semantics, defaults, validation, or failure behavior. When exact
511
+ cross-runtime correspondence matters, start from the operation ID and its
512
+ shared schema or conformance fixture.
513
+
514
+ ## Storage portability
515
+
516
+ The Python runtime's SQLite tables, migration ledger, filesystem layout, and
517
+ the corresponding .NET layouts are implementation-private. They are not a
518
+ binary compatibility surface, even when the filenames look alike. Do not copy
519
+ `vyral.sqlite`, a CanonicalStore database, or an execution database from one
520
+ runtime into the other.
521
+
522
+ Cross-runtime movement uses documented public envelopes: collection and graph
523
+ exports, CanonicalStore tenant archives, objects, and execution-owned outputs
524
+ where supported. Those envelopes and their shared conformance fixtures—not raw
525
+ SQLite bytes—are the portability contract.
526
+
527
+ ## Contract and fixture verification
528
+
529
+ Every runtime construction validates the bundled OpenAPI, JSON Schema, and SDK
530
+ catalog. Embedded `VyralRuntime()` construction does not execute the complete
531
+ golden corpus by default, keeping notebook and test composition proportional as
532
+ the fixture set grows. Use `VyralRuntime(verify_assets=True)` when construction
533
+ itself must fail closed on both the contract bundle and goldens.
534
+
535
+ Readiness always executes the bundled goldens. The optional REST/MCP host also
536
+ constructs its owned runtime with `verify_assets=True`, and release
537
+ qualification runs the canonical fixture suite separately. This keeps
538
+ construction fast without weakening host startup or qualification evidence.
539
+
540
+ ## Optional server
541
+
542
+ Install the server extra and choose an explicit durable directory:
543
+
544
+ ```bash
545
+ python -m pip install "vyral[server]"
546
+ export VYRAL_API_KEY="replace-with-a-secret"
547
+ vyral serve --root ./.vyral --host 127.0.0.1 --port 5220
548
+ ```
549
+
550
+ REST is available at the public OpenAPI paths and stateless MCP at `/mcp`.
551
+ API-key hosts accept `X-Vyral-Api-Key` or a bearer token. Localhost Host/Origin
552
+ validation is enabled by default. A non-loopback CLI bind is rejected unless
553
+ `VYRAL_API_KEY` is set; wildcard binds also require one or more explicit
554
+ `--allowed-host` values. Browser deployments opt into exact origins with
555
+ `--allowed-origin`; add `--require-explicit-origin` to disable MCP's
556
+ same-host browser fallback. Add `--require-api-key` when a loopback host must
557
+ also fail closed without credentials. Request access logs are disabled by
558
+ default. The SQLite/filesystem composition is a single-node topology even
559
+ though each MCP request can be parsed and authorized without session affinity.
560
+ See the [Python host security guide](../../docs/guides/python-host-security.md)
561
+ before exposing a host beyond a single trusted user or process boundary.
562
+
563
+ The baseline qualification corpus is 2,000 records with 384-dimensional exact
564
+ vectors, a roughly 200-chunk RAG document, and 20 durable jobs. This is a
565
+ bounded evidence run for notebook and small local-service use, not an SLA or a
566
+ maximum supported corpus. Hosted wall-clock time is recorded rather than used
567
+ as a release gate; controlled runners can opt into a limit with
568
+ `--max-seconds`.
569
+
570
+ ## Development checks
571
+
572
+ From the repository root:
573
+
574
+ ```bash
575
+ scripts/verify-python-runtime.sh
576
+ python3 scripts/verify-python-external-worker-integration.py
577
+ scripts/verify-python-runtime-external-worker.sh path/to/vyral.whl
578
+ scripts/verify-python-runtime-mcp-conformance.sh path/to/vyral.whl
579
+ python3 scripts/verify-python-runtime-security.py path/to/vyral.whl
580
+ python3 scripts/verify-python-runtime-upgrade.py \
581
+ path/to/vyral-0.1.0.whl path/to/vyral-0.1.1.whl
582
+ python3 scripts/benchmark-python-runtime.py
583
+ dotnet test tests/Vyral.Tests.Conformance/Vyral.Tests.Conformance.csproj \
584
+ --filter 'PortableRuntimeGoldenFixtureTests|PortableExternalWorkerLifecycleFixtureTests'
585
+ ```
586
+
587
+ The main verification command runs the full unit suite with branch
588
+ instrumentation using pinned Coverage.py 7.15.4 and enforces a 77.5% combined
589
+ line/branch regression floor. The floor is a regression guard, not a claim
590
+ that every dispatch or error branch is exhaustively tested.
591
+
592
+ The cross-platform qualification workflow is manual-only:
593
+ `.github/workflows/python-runtime-qualification.yml`. This preserves the
594
+ repository's current GitHub-run gate while keeping the promotion matrix
595
+ reproducible. Every cell builds both artifacts, installs each into a clean
596
+ environment, completes the real cited/restart quickstart, replays it from a
597
+ second process, inspects its limitations, and safely resets its owned state.
598
+ The HTTPS URL and SHA-256 of a previously qualified `0.1.x` wheel are optional
599
+ paired inputs: when supplied, the workflow also runs the installed upgrade
600
+ gate, which cannot silently self-compare the candidate. The aggregate job then runs
601
+ `scripts/verify-python-runtime-platform-matrix.py`; all nine cells must be
602
+ clean, refer to one commit, agree on runtime and contract identity, and carry
603
+ passing measured local-experience evidence before the matrix is valid. A run
604
+ without a baseline proves the platform matrix but is not upgrade evidence and
605
+ does not by itself authorize maturity promotion.