annoscript 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.
- annoscript/__init__.py +1 -0
- annoscript/_backend_profiles.py +17 -0
- annoscript/_client_common.py +287 -0
- annoscript/_data.py +37 -0
- annoscript/_dispatch_pool.py +47 -0
- annoscript/_env.py +19 -0
- annoscript/_examples.py +34 -0
- annoscript/_expressions.py +93 -0
- annoscript/_plan_viewer.html +953 -0
- annoscript/_remote_jobs.py +211 -0
- annoscript/_request_adapters.py +71 -0
- annoscript/_speculation.py +321 -0
- annoscript/_test_artifacts.py +33 -0
- annoscript/_test_evaluation_http.py +117 -0
- annoscript/_test_ir_runtime.py +138 -0
- annoscript/_test_job_process.py +166 -0
- annoscript/_test_plan_runtime.py +331 -0
- annoscript/_test_remote_client.py +46 -0
- annoscript/_test_remote_server.py +75 -0
- annoscript/_test_synthetic.py +67 -0
- annoscript/anno.py +270 -0
- annoscript/backends/__init__.py +13 -0
- annoscript/backends/_batch_wire.py +26 -0
- annoscript/backends/_bounded_grammar.py +97 -0
- annoscript/backends/_example_layout.py +23 -0
- annoscript/backends/_generation_policy.py +116 -0
- annoscript/backends/_grammar.py +83 -0
- annoscript/backends/_preview.py +13 -0
- annoscript/backends/_prompt.py +115 -0
- annoscript/backends/_shared_rules.py +38 -0
- annoscript/backends/adapters/__init__.py +17 -0
- annoscript/backends/adapters/chat.py +39 -0
- annoscript/backends/adapters/decision.py +119 -0
- annoscript/backends/base.py +427 -0
- annoscript/backends/config.py +67 -0
- annoscript/backends/decision.py +150 -0
- annoscript/backends/llm.py +338 -0
- annoscript/client.py +247 -0
- annoscript/client_tests.py +17 -0
- annoscript/compiler.py +708 -0
- annoscript/cross_version_tests.py +68 -0
- annoscript/fixtures/request-adapters-v1.json +4741 -0
- annoscript/formatter.py +171 -0
- annoscript/grammar_tests.py +176 -0
- annoscript/inspect.py +77 -0
- annoscript/ir.py +458 -0
- annoscript/job_cross_version_tests.py +118 -0
- annoscript/job_protocol.py +180 -0
- annoscript/jobs.py +255 -0
- annoscript/metrics.py +153 -0
- annoscript/p0_grammar_tests.py +147 -0
- annoscript/passes/__init__.py +40 -0
- annoscript/passes/_analysis.py +178 -0
- annoscript/passes/control_flow.py +68 -0
- annoscript/passes/dead_assignments.py +44 -0
- annoscript/passes/folding.py +104 -0
- annoscript/passes/propagation.py +53 -0
- annoscript/passes/temporaries.py +45 -0
- annoscript/plan.py +542 -0
- annoscript/plan_formatter.py +452 -0
- annoscript/plan_lowering.py +571 -0
- annoscript/preview.py +115 -0
- annoscript/remote.py +304 -0
- annoscript/runtime.py +861 -0
- annoscript/server/__init__.py +1 -0
- annoscript/server/__main__.py +49 -0
- annoscript/server/_plan_cache.py +79 -0
- annoscript/server/api.py +146 -0
- annoscript/server/metrics.py +140 -0
- annoscript/server/migrate.py +61 -0
- annoscript/server/releases.py +143 -0
- annoscript/server/store.py +429 -0
- annoscript/server/worker.py +290 -0
- annoscript/substring_tests.py +79 -0
- annoscript/test_advisory_lengths.py +115 -0
- annoscript/test_backends.py +181 -0
- annoscript/test_client.py +349 -0
- annoscript/test_compact_batch.py +95 -0
- annoscript/test_compiler.py +444 -0
- annoscript/test_decision_adapters.py +410 -0
- annoscript/test_decision_wire.py +190 -0
- annoscript/test_diagnostics.py +97 -0
- annoscript/test_engineering_p0.py +191 -0
- annoscript/test_environment.py +65 -0
- annoscript/test_example_backends.py +251 -0
- annoscript/test_examples.py +149 -0
- annoscript/test_field_names.py +221 -0
- annoscript/test_formatter.py +153 -0
- annoscript/test_fusion_scheduling.py +109 -0
- annoscript/test_generation_policy.py +180 -0
- annoscript/test_ir.py +148 -0
- annoscript/test_jobs.py +371 -0
- annoscript/test_jobs_server.py +511 -0
- annoscript/test_llm_batch.py +428 -0
- annoscript/test_metrics.py +59 -0
- annoscript/test_metrics_server.py +261 -0
- annoscript/test_minimal_fusion.py +59 -0
- annoscript/test_nullable_generate.py +169 -0
- annoscript/test_passes.py +408 -0
- annoscript/test_plan.py +522 -0
- annoscript/test_plan_constraints.py +305 -0
- annoscript/test_plan_formatter.py +272 -0
- annoscript/test_prompt_layout.py +140 -0
- annoscript/test_qwen_backend.py +181 -0
- annoscript/test_qwen_pilot_regression.py +180 -0
- annoscript/test_release_client.py +20 -0
- annoscript/test_remote.py +308 -0
- annoscript/test_request_adapters.py +295 -0
- annoscript/test_requirements.py +228 -0
- annoscript/test_rule_dedup.py +67 -0
- annoscript/test_runtime.py +314 -0
- annoscript/test_runtime_client.py +133 -0
- annoscript/test_source_fields.py +111 -0
- annoscript/test_speculation.py +458 -0
- annoscript/test_substring_backend.py +81 -0
- annoscript/test_synthetic_example.py +61 -0
- annoscript-0.1.0.dist-info/METADATA +145 -0
- annoscript-0.1.0.dist-info/RECORD +128 -0
- annoscript-0.1.0.dist-info/WHEEL +4 -0
- annoscript-0.1.0.dist-info/licenses/LICENSE +21 -0
- annoscript_examples/__init__.py +1 -0
- annoscript_examples/fixtures.py +3 -0
- annoscript_examples/request.execution_plan.json +3017 -0
- annoscript_examples/request.json +858 -0
- annoscript_examples/request.py +37 -0
- annoscript_examples/request_preview.decision.json +23 -0
- annoscript_examples/request_preview.generation.json +20 -0
- annoscript_examples/run.py +24 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Offline cross-process acceptance; both interpreters are mandatory.
|
|
2
|
+
|
|
3
|
+
python -m annoscript.cross_version_tests --client-python /path/to/python3.10 \
|
|
4
|
+
--server-python /path/to/python3.12
|
|
5
|
+
|
|
6
|
+
The loopback HTTP fixture is test-only, not an execution service to deploy.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import json
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
import subprocess
|
|
13
|
+
import tempfile
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def interpreter(path, version):
|
|
17
|
+
completed = subprocess.run([path, "-c", "import sys; print('%d.%d' % sys.version_info[:2])"],
|
|
18
|
+
capture_output=True, text=True, check=True, timeout=10)
|
|
19
|
+
if completed.stdout.strip() != version:
|
|
20
|
+
raise ValueError(f"expected Python {version}, got {completed.stdout.strip()} from {path}")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def main():
|
|
24
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
25
|
+
parser.add_argument("--client-python", required=True)
|
|
26
|
+
parser.add_argument("--server-python", required=True)
|
|
27
|
+
args = parser.parse_args()
|
|
28
|
+
interpreter(args.client_python, "3.10")
|
|
29
|
+
interpreter(args.server_python, "3.12")
|
|
30
|
+
root = Path(__file__).resolve().parents[1]
|
|
31
|
+
# Generate only temporary IPC fixtures, never checked-in artifacts.
|
|
32
|
+
with tempfile.TemporaryDirectory(prefix="anno-cross-version-") as folder:
|
|
33
|
+
fixture = Path(folder, "cases.json")
|
|
34
|
+
server = subprocess.Popen([args.server_python, "-m", "annoscript._test_remote_server", str(fixture)],
|
|
35
|
+
cwd=root, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
|
36
|
+
try:
|
|
37
|
+
# A reader future bounds startup without polling the filesystem.
|
|
38
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
39
|
+
with ThreadPoolExecutor(max_workers=1) as pool:
|
|
40
|
+
future = pool.submit(server.stdout.readline)
|
|
41
|
+
try:
|
|
42
|
+
ready = json.loads(future.result(timeout=30))
|
|
43
|
+
except BaseException:
|
|
44
|
+
server.terminate()
|
|
45
|
+
server.wait(timeout=10)
|
|
46
|
+
raise
|
|
47
|
+
if ready.get("python") != "3.12" or not ready.get("url"):
|
|
48
|
+
raise RuntimeError("invalid test-server startup response")
|
|
49
|
+
completed = subprocess.run(
|
|
50
|
+
[args.client_python, "-m", "annoscript._test_remote_client", ready["url"], str(fixture)],
|
|
51
|
+
cwd=root, timeout=180,
|
|
52
|
+
)
|
|
53
|
+
if completed.returncode:
|
|
54
|
+
raise RuntimeError(f"cross-version client exited with {completed.returncode}")
|
|
55
|
+
finally:
|
|
56
|
+
server.terminate()
|
|
57
|
+
try:
|
|
58
|
+
_, errors = server.communicate(timeout=10)
|
|
59
|
+
except subprocess.TimeoutExpired:
|
|
60
|
+
server.kill()
|
|
61
|
+
_, errors = server.communicate()
|
|
62
|
+
if errors:
|
|
63
|
+
raise RuntimeError("test server failed:\n" + errors)
|
|
64
|
+
print("Python 3.10 IR client -> Python 3.12 optimizing Runtime: OK (offline)")
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
if __name__ == "__main__":
|
|
68
|
+
main()
|