qcoder 0.3.0a1__tar.gz → 0.4.0a2__tar.gz
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.
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/CHANGELOG.md +35 -0
- qcoder-0.4.0a2/PKG-INFO +188 -0
- qcoder-0.4.0a2/README.md +158 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/docs/architecture.md +6 -1
- qcoder-0.4.0a2/docs/model-cards/resource-guidance-local-v0.md +33 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/pyproject.toml +4 -1
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/__init__.py +1 -1
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/cli.py +26 -2
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/core/run_config.py +1 -17
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/context/bundle.py +28 -5
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/context/markdown.py +34 -0
- qcoder-0.4.0a2/src/qcoder/engines/guidance/model_pack.py +353 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/guidance/resource.py +97 -34
- qcoder-0.4.0a2/src/qcoder/engines/guidance/structural_scores.py +98 -0
- qcoder-0.4.0a2/src/qcoder/engines/profiles/__init__.py +5 -0
- qcoder-0.4.0a2/src/qcoder/engines/profiles/feature_profiles_v0.py +272 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/review/bundle.py +29 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/review/markdown.py +10 -0
- qcoder-0.4.0a2/src/qcoder/model_packs/__init__.py +1 -0
- qcoder-0.4.0a2/src/qcoder/model_packs/resource_guidance_local_v0.json +183 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/pipelines/analyze.py +11 -30
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/pipelines/context.py +7 -1
- qcoder-0.4.0a2/src/qcoder.egg-info/PKG-INFO +188 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder.egg-info/SOURCES.txt +11 -41
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_analyze_pipeline.py +13 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_cli_context_review.py +45 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_cli_help.py +33 -0
- qcoder-0.4.0a2/tests/test_context_bundle.py +260 -0
- qcoder-0.4.0a2/tests/test_examples_smoke.py +95 -0
- qcoder-0.4.0a2/tests/test_feature_profiles.py +135 -0
- qcoder-0.4.0a2/tests/test_guidance_model_pack.py +146 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_resource_guidance.py +56 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_review_bundle.py +49 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_review_qiskit_counts.py +5 -0
- qcoder-0.4.0a2/tests/test_smoke.py +23 -0
- qcoder-0.3.0a1/PKG-INFO +0 -126
- qcoder-0.3.0a1/README.md +0 -96
- qcoder-0.3.0a1/src/qcoder/engines/prediction_model/__init__.py +0 -16
- qcoder-0.3.0a1/src/qcoder/engines/prediction_model/artifact.py +0 -85
- qcoder-0.3.0a1/src/qcoder/engines/prediction_model/engine.py +0 -209
- qcoder-0.3.0a1/src/qcoder/engines/prediction_model/models.py +0 -62
- qcoder-0.3.0a1/src/qcoder/engines/prediction_model/policy.py +0 -45
- qcoder-0.3.0a1/src/qcoder/engines/prediction_model/schema_alignment.py +0 -41
- qcoder-0.3.0a1/src/qcoder/engines/quantumness/__init__.py +0 -8
- qcoder-0.3.0a1/src/qcoder/engines/quantumness/scorer.py +0 -254
- qcoder-0.3.0a1/src/qcoder/tools/analyze.py +0 -88
- qcoder-0.3.0a1/src/qcoder/tools/analyze_shot_scaling.py +0 -239
- qcoder-0.3.0a1/src/qcoder/tools/generate_corpus.py +0 -491
- qcoder-0.3.0a1/src/qcoder/tools/harness.py +0 -15
- qcoder-0.3.0a1/src/qcoder/tools/inspect_corpus_features.py +0 -273
- qcoder-0.3.0a1/src/qcoder/tools/join_runs_features.py +0 -252
- qcoder-0.3.0a1/src/qcoder/tools/mirror.py +0 -15
- qcoder-0.3.0a1/src/qcoder/tools/predict_baseline.py +0 -347
- qcoder-0.3.0a1/src/qcoder/tools/qr_dll_bootstrap.py +0 -31
- qcoder-0.3.0a1/src/qcoder/tools/runner.py +0 -15
- qcoder-0.3.0a1/src/qcoder/tools/runners/__init__.py +0 -1
- qcoder-0.3.0a1/src/qcoder/tools/runners/quantum_rings/__init__.py +0 -1
- qcoder-0.3.0a1/src/qcoder/tools/runners/quantum_rings/v12/__init__.py +0 -1
- qcoder-0.3.0a1/src/qcoder/tools/runners/quantum_rings/v12/harness.py +0 -1350
- qcoder-0.3.0a1/src/qcoder/tools/runners/quantum_rings/v12/mirror.py +0 -459
- qcoder-0.3.0a1/src/qcoder/tools/runners/quantum_rings/v12/runner.py +0 -549
- qcoder-0.3.0a1/src/qcoder/tools/train_baseline_models.py +0 -619
- qcoder-0.3.0a1/src/qcoder/tools/validate_baseline.py +0 -307
- qcoder-0.3.0a1/src/qcoder.egg-info/PKG-INFO +0 -126
- qcoder-0.3.0a1/tests/test_analyze_prediction_integration.py +0 -62
- qcoder-0.3.0a1/tests/test_analyze_shot_scaling.py +0 -103
- qcoder-0.3.0a1/tests/test_context_bundle.py +0 -123
- qcoder-0.3.0a1/tests/test_generate_corpus.py +0 -113
- qcoder-0.3.0a1/tests/test_harness_schema_labels.py +0 -293
- qcoder-0.3.0a1/tests/test_inspect_corpus_features.py +0 -118
- qcoder-0.3.0a1/tests/test_join_runs_features.py +0 -170
- qcoder-0.3.0a1/tests/test_predict_baseline.py +0 -400
- qcoder-0.3.0a1/tests/test_prediction_artifact_io.py +0 -55
- qcoder-0.3.0a1/tests/test_prediction_fidelity_curve.py +0 -151
- qcoder-0.3.0a1/tests/test_prediction_policy.py +0 -35
- qcoder-0.3.0a1/tests/test_prediction_schema_alignment.py +0 -40
- qcoder-0.3.0a1/tests/test_quantumness_scorer.py +0 -137
- qcoder-0.3.0a1/tests/test_smoke.py +0 -20
- qcoder-0.3.0a1/tests/test_train_baseline_models.py +0 -158
- qcoder-0.3.0a1/tests/test_validate_baseline.py +0 -241
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/LICENSE +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/MANIFEST.in +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/NOTICE +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/setup.cfg +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/__main__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/core/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/core/context.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/core/qasm2/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/core/qasm2/adjoint_eligibility.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/core/qasm2/mirror_build.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/core/schema.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/context/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/adapters/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/adapters/cirq_intake.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/adapters/pennylane_intake.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/adapters/qiskit_intake.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/extractor.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/features/compute_v0.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/features/glossary_v0.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/features/schema_v0.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/ir.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/labeling.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/parsers/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/qasm2_regex_parser.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/reps/cut_profile.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/reps/depth.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/reps/entangling_layers.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/reps/gate_set_stats.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/reps/interaction_graph.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/reps/interaction_graph_metrics.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/feature_extraction/reps/spans.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/guidance/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/review/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/review/counts_v0.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/engines/review/qiskit_counts.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/pipelines/batch.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/pipelines/review.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder/tools/batch.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder.egg-info/dependency_links.txt +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder.egg-info/entry_points.txt +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder.egg-info/requires.txt +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/src/qcoder.egg-info/top_level.txt +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_adjoint_eligibility.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_batch_pipeline.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_cirq_intake.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_cli_batch_nested_discovery.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_cut_profile.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_entangling_layers.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_feature_glossary.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_gate_set_stats.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_interaction_graph_metrics.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_mirror_build.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_parse_qasm2_text.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_pennylane_intake.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_qiskit_intake.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_review_counts_v0.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_schema_stability.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a2}/tests/test_temporal_spans.py +0 -0
|
@@ -4,6 +4,41 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on common practice for pre-1.0 semantic versioning: **`MAJOR.MINOR.PATCH`** with **`aN`** for alpha prereleases.
|
|
6
6
|
|
|
7
|
+
## 0.4.0a2 (alpha)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **Local Guidance Pack shadow metadata** — optional **`guidance_metadata`** records the bundled local resource-guidance candidate pack, including pack identity, version/hash metadata, caveats, and **`shadow_guidance`** with **`applied: false`**; deterministic guidance remains authoritative.
|
|
12
|
+
|
|
13
|
+
### Improved
|
|
14
|
+
|
|
15
|
+
- **Free Single-Run Intelligence** and **BYO LLM** artifact examples clarify that shadow guidance is metadata only.
|
|
16
|
+
- **Release notes** — this alpha has no hosted qCoder compute, no telemetry upload, no qCoder-hosted LLM, no runtime ML dependency, and no optimality, fidelity, runtime, hardware, backend-ranking, or causal-savings claims.
|
|
17
|
+
|
|
18
|
+
## 0.4.0a1 (alpha)
|
|
19
|
+
|
|
20
|
+
qCoder **0.4.0a1** adds opt-in derived **feature profiles**, mixed-width **review** checks, and a **5‑minute preflight→review** path.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- **`--profiles`** on **`qcoder analyze --json`** and **`qcoder context`** — deterministic derived **`feature_profiles`** from **`feature_map`**, emitted with **`feature_profiles_schema_version: "0.1"`** and **`basis: "deterministic_formula_from_feature_map"`**; **`not_guarantees: true`**.
|
|
25
|
+
- **`bitstring_width_consistency`** check in **`qcoder review`** — warns when observed bitstring key lengths disagree; derived metrics still use observed counts (also covers **`qcoder`** and **`qiskit_counts`** normalization paths).
|
|
26
|
+
|
|
27
|
+
### Improved
|
|
28
|
+
|
|
29
|
+
- **README — First 5 minutes** — quick install → Bell QASM → **`qcoder context --guidance --profiles`** → **`qcoder review`** with sample counts.
|
|
30
|
+
- **`examples/`** — Bell OpenQASM, illustrative counts fixture, copy-paste workflow docs, and optional **Qiskit / Cirq / PennyLane** export scripts (structure/export only).
|
|
31
|
+
- **Profile label polish** — `connected_small_graph` for tiny circuits instead of misleading `connected_high_density`; **`statevector_scale`** tier key (replacing `circuit_width`); **`llm_summary_profile`** rendered as short sub-bullets in preflight Markdown.
|
|
32
|
+
- **Execution review Markdown** — explicit that counts are user-provided and qCoder did not execute the circuit; **Assumptions and Limits** section when present.
|
|
33
|
+
|
|
34
|
+
### Unchanged / scope
|
|
35
|
+
|
|
36
|
+
- **Canonical feature schema** — same version, field order, and feature vector layout as **`0.3.0a1`** (`schema_v0`/compute path); profiles are additive only and do not alter canonical **`features`**.
|
|
37
|
+
|
|
38
|
+
### Local-only boundaries
|
|
39
|
+
|
|
40
|
+
- No LLM calls, telemetry, uploads, retrieval, or embeddings; no simulator or hardware execution, transpilation, or runtime execution in these CLI flows. Artifacts are local files under your control.
|
|
41
|
+
|
|
7
42
|
## 0.3.0a1 (alpha)
|
|
8
43
|
|
|
9
44
|
Optional Cirq and PennyLane intake alongside the existing Qiskit adapter. All adapters follow the same structural rules: framework object → OpenQASM 2 text → qCoder's shared parser pipeline.
|
qcoder-0.4.0a2/PKG-INFO
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qcoder
|
|
3
|
+
Version: 0.4.0a2
|
|
4
|
+
Summary: Quantum circuit analysis and structured feature extraction tools.
|
|
5
|
+
Author-email: Quantum Ready Solutions <support@qcoder.ai>
|
|
6
|
+
Maintainer-email: Quantum Ready Solutions <support@qcoder.ai>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Project-URL: Homepage, https://qcoder.ai
|
|
9
|
+
Project-URL: Documentation, https://qcoder.ai/manual/
|
|
10
|
+
Project-URL: Repository, https://github.com/QuantumReadySolutions/qCoder
|
|
11
|
+
Project-URL: Issues, https://github.com/QuantumReadySolutions/qCoder/issues
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
License-File: NOTICE
|
|
22
|
+
Requires-Dist: numpy
|
|
23
|
+
Provides-Extra: qiskit
|
|
24
|
+
Requires-Dist: qiskit>=1.0; extra == "qiskit"
|
|
25
|
+
Provides-Extra: cirq
|
|
26
|
+
Requires-Dist: cirq-core>=1.4; extra == "cirq"
|
|
27
|
+
Provides-Extra: pennylane
|
|
28
|
+
Requires-Dist: pennylane>=0.44; extra == "pennylane"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# qCoder
|
|
32
|
+
|
|
33
|
+
**qCoder** helps you **plan and review quantum circuit runs** using **local, deterministic artifacts** (JSON and Markdown): preflight context from circuit **structure**, then post-run review from **counts you provide**. It does **not** call an LLM, send telemetry, upload data, run a simulator or hardware, perform retrieval, or create embeddings.
|
|
34
|
+
|
|
35
|
+
Stable structural **feature vectors** (`schema_version`, `feature_names`, `features`) and a readable **`feature_map`** sit underneath; they power the guidance and profile layers but are not the whole story for day-one use.
|
|
36
|
+
|
|
37
|
+
**CLI:** **`qcoder analyze`**, **`qcoder batch`**, **`qcoder context`**, **`qcoder review`**. Optional **`qcoder[qiskit]`**, **`qcoder[cirq]`**, **`qcoder[pennylane]`** — Python-only **structure/export intake** into the same extractor as OpenQASM (no simulator or hardware execution inside qCoder).
|
|
38
|
+
|
|
39
|
+
**Company / legal:** Quantum Ready Solutions. **Product docs:** [qcoder.ai](https://qcoder.ai) · [manual](https://qcoder.ai/manual/). **Source:** [github.com/QuantumReadySolutions/qCoder](https://github.com/QuantumReadySolutions/qCoder). **Support:** [support@qcoder.ai](mailto:support@qcoder.ai).
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## First 5 minutes: preflight → review
|
|
44
|
+
|
|
45
|
+
**1. Install** (Python **3.11+**; runtime dependency **NumPy**):
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install qcoder
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Pre-release lines on PyPI may look like **`0.4.0a2`**.
|
|
52
|
+
|
|
53
|
+
**2. Create a small Bell circuit** as `bell.qasm` (OpenQASM 2), or use the copy in **[`examples/circuits/bell.qasm`](examples/circuits/bell.qasm)** from a clone:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
OPENQASM 2.0;
|
|
57
|
+
include "qelib1.inc";
|
|
58
|
+
qreg q[2];
|
|
59
|
+
creg c[2];
|
|
60
|
+
h q[0];
|
|
61
|
+
cx q[0],q[1];
|
|
62
|
+
measure q[0] -> c[0];
|
|
63
|
+
measure q[1] -> c[1];
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**3. Build preflight context** (heuristic resource guidance + optional structural taxonomy profiles):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
qcoder context bell.qasm \
|
|
70
|
+
--out-json preflight.context.json \
|
|
71
|
+
--out-md preflight.context.md \
|
|
72
|
+
--guidance --profiles
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
From the repo root you can instead run:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
qcoder context examples/circuits/bell.qasm \
|
|
79
|
+
--out-json preflight.context.json \
|
|
80
|
+
--out-md preflight.context.md \
|
|
81
|
+
--guidance --profiles
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**4. Review with sample counts** (illustrative counts only—not produced by qCoder). From a **clone**, use the fixture **[`examples/fixtures/bell_counts_qiskit.json`](examples/fixtures/bell_counts_qiskit.json)**:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
qcoder review \
|
|
88
|
+
--counts-json examples/fixtures/bell_counts_qiskit.json \
|
|
89
|
+
--format qiskit_counts \
|
|
90
|
+
--preflight-json preflight.context.json \
|
|
91
|
+
--out-json execution.review.json \
|
|
92
|
+
--out-md execution.review.md
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
If you only have **`pip install`** and no **`examples/`** tree, write the same payload to a file and pass that path:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
printf '%s\n' '{"00": 5, "11": 3}' > counts.json
|
|
99
|
+
qcoder review \
|
|
100
|
+
--counts-json counts.json \
|
|
101
|
+
--format qiskit_counts \
|
|
102
|
+
--preflight-json preflight.context.json \
|
|
103
|
+
--out-json execution.review.json \
|
|
104
|
+
--out-md execution.review.md
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
In real use, **`counts.json`** comes from **your** simulator or hardware pipeline; qCoder only reads the file you pass in.
|
|
108
|
+
|
|
109
|
+
**Examples:** **[`examples/README.md`](examples/README.md)** (Bell QASM + illustrative counts for clones).
|
|
110
|
+
|
|
111
|
+
- **Free single-run intelligence** and **BYO LLM artifact workflow:** [`examples/06_single_run_intelligence.md`](examples/06_single_run_intelligence.md), [`examples/07_byo_llm_artifact_pack.md`](examples/07_byo_llm_artifact_pack.md), copy-paste prompt [`examples/prompts/single_run_artifact_to_action.md`](examples/prompts/single_run_artifact_to_action.md).
|
|
112
|
+
- Full walkthrough on the site: [Single-run intelligence with qCoder](https://qcoder.ai/manual/workflows/single-run-intelligence/).
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## What qCoder analyzes
|
|
117
|
+
|
|
118
|
+
qCoder summarizes **circuit structure** from OpenQASM (and optional framework export paths). Pair its JSON with **your** run data whenever you need **execution evidence**.
|
|
119
|
+
|
|
120
|
+
## Package layout (supported public surface)
|
|
121
|
+
|
|
122
|
+
**Current supported public surface:**
|
|
123
|
+
|
|
124
|
+
- **`qcoder analyze`** — single-circuit extraction (human or `--json`).
|
|
125
|
+
- **`qcoder batch`** — directory batch to **JSONL**.
|
|
126
|
+
- **Optional `--guidance`** on `analyze` / `batch` — deterministic heuristic starting points (shots and simulator/MPS settings) derived from circuit structure.
|
|
127
|
+
- **Optional `--profiles`** on **`qcoder context`** and on **`qcoder analyze --json`** — deterministic derived structural taxonomy from `feature_map` (additive, non-canonical). For **`analyze`**, use **`--json --profiles`** together.
|
|
128
|
+
- **`qcoder context`** — deterministic preflight context artifacts (**JSON + Markdown**), including optional `--guidance`, optional **`--profiles`**, and optional **`--full-features`** glossary appendix.
|
|
129
|
+
- **`qcoder review`** — deterministic post-run review artifacts (**JSON + Markdown**) from user-provided counts.
|
|
130
|
+
- **Counts intake normalization** — `qcoder.counts.v0` and `qiskit_counts` normalization into the same deterministic review path.
|
|
131
|
+
- **`qcoder[qiskit]`** — optional `QuantumCircuit` intake into the **same extractor** as OpenQASM.
|
|
132
|
+
- **`qcoder[cirq]`** — optional Cirq `Circuit` intake into the **same extractor** as OpenQASM.
|
|
133
|
+
- **`qcoder[pennylane]`** — optional PennyLane circuit intake into the **same extractor** as OpenQASM.
|
|
134
|
+
- **Documented feature output** — see [qcoder.ai — Feature reference](https://qcoder.ai/manual/feature-reference/) and `engines/feature_extraction/features/schema_v0.py`; JSON carries a **`schema_version`** alongside named fields.
|
|
135
|
+
|
|
136
|
+
The public package contains the documented deterministic free-product surface above.
|
|
137
|
+
|
|
138
|
+
Brief notes live in **`docs/architecture.md`**.
|
|
139
|
+
|
|
140
|
+
## Install (optional extras)
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
pip install "qcoder[qiskit]"
|
|
144
|
+
pip install "qcoder[cirq]"
|
|
145
|
+
pip install "qcoder[pennylane]"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Machine-readable JSON from **`qcoder analyze --json`** includes a derived **`feature_map`** object (`name → value`) for easier reading. The canonical circuit feature bundle remains the nested **`features`** object (`schema_version`, **`feature_names`**, **`features`**).
|
|
149
|
+
|
|
150
|
+
Optional **`--guidance`** adds heuristic shot-count and simulator/MPS starting-point suggestions derived from structural features. These suggestions are transparent, non-guaranteed starting points only; qCoder performs no backend execution and includes no telemetry/upload in this flow. When a bundled local guidance pack is present, the guidance JSON may also include **`guidance_metadata`** (pack id/version/hash, shadow suggestions, explicit `fallback_used`) for BYO-LLM workflows; **deterministic** `pressure` / `starting_points` remain the user-visible values until a future release explicitly applies pack output.
|
|
151
|
+
|
|
152
|
+
Optional **`--profiles`** adds deterministic **`feature_profiles`** derived from `feature_map` for compact structural taxonomy. This is an additive interpretation layer with its own schema version and does not modify canonical `features` (`schema_version`, `feature_names`, `features`).
|
|
153
|
+
|
|
154
|
+
`qcoder context` and `qcoder review` generate deterministic local artifacts (JSON + Markdown) intended for user-controlled planning/review workflows. "LLM-ready/RAG-ready" in this project means users can attach or paste these artifacts manually; qCoder itself performs no retrieval, embeddings, network calls, or telemetry/upload in this flow.
|
|
155
|
+
|
|
156
|
+
The optional Qiskit, Cirq, and PennyLane adapters are structure/export intake paths only. qCoder does not execute simulators or hardware backends in these flows.
|
|
157
|
+
|
|
158
|
+
## CLI reference (other commands)
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
qcoder analyze path/to/circuit.qasm
|
|
162
|
+
qcoder analyze path/to/circuit.qasm --json
|
|
163
|
+
qcoder analyze path/to/circuit.qasm --json --guidance
|
|
164
|
+
qcoder analyze path/to/circuit.qasm --json --profiles
|
|
165
|
+
qcoder context path/to/circuit.qasm --out-json preflight.context.json --out-md preflight.context.md --guidance
|
|
166
|
+
qcoder context path/to/circuit.qasm --out-json preflight.context.json --out-md preflight.context.md --profiles
|
|
167
|
+
qcoder batch circuits --out batch.features.jsonl --pattern "*.qasm"
|
|
168
|
+
qcoder batch circuits --out batch.features.jsonl --pattern "*.qasm" --guidance
|
|
169
|
+
qcoder review --counts-json counts.json --format qiskit_counts --preflight-json preflight.context.json --out-json execution.review.json --out-md execution.review.md
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Batch:** JSONL records are written to **`--out`**. Status lines (for example record counts) may go to **stderr**, so prefer **`--out`** over shell stdout redirection for the JSONL stream.
|
|
173
|
+
|
|
174
|
+
## Develop / test (from a clone)
|
|
175
|
+
|
|
176
|
+
If you use **pyenv**, select the intended Python before creating the venv (for example `pyenv local 3.11.x` or `pyenv shell 3.11.x`) so `python -m venv` uses that interpreter.
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
python -m venv .venv
|
|
180
|
+
source .venv/bin/activate
|
|
181
|
+
pip install -e ".[qiskit]"
|
|
182
|
+
pip install pytest
|
|
183
|
+
pytest -q
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
Licensed under the **Apache License 2.0**. See `LICENSE` and `NOTICE`.
|
qcoder-0.4.0a2/README.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# qCoder
|
|
2
|
+
|
|
3
|
+
**qCoder** helps you **plan and review quantum circuit runs** using **local, deterministic artifacts** (JSON and Markdown): preflight context from circuit **structure**, then post-run review from **counts you provide**. It does **not** call an LLM, send telemetry, upload data, run a simulator or hardware, perform retrieval, or create embeddings.
|
|
4
|
+
|
|
5
|
+
Stable structural **feature vectors** (`schema_version`, `feature_names`, `features`) and a readable **`feature_map`** sit underneath; they power the guidance and profile layers but are not the whole story for day-one use.
|
|
6
|
+
|
|
7
|
+
**CLI:** **`qcoder analyze`**, **`qcoder batch`**, **`qcoder context`**, **`qcoder review`**. Optional **`qcoder[qiskit]`**, **`qcoder[cirq]`**, **`qcoder[pennylane]`** — Python-only **structure/export intake** into the same extractor as OpenQASM (no simulator or hardware execution inside qCoder).
|
|
8
|
+
|
|
9
|
+
**Company / legal:** Quantum Ready Solutions. **Product docs:** [qcoder.ai](https://qcoder.ai) · [manual](https://qcoder.ai/manual/). **Source:** [github.com/QuantumReadySolutions/qCoder](https://github.com/QuantumReadySolutions/qCoder). **Support:** [support@qcoder.ai](mailto:support@qcoder.ai).
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## First 5 minutes: preflight → review
|
|
14
|
+
|
|
15
|
+
**1. Install** (Python **3.11+**; runtime dependency **NumPy**):
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install qcoder
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Pre-release lines on PyPI may look like **`0.4.0a2`**.
|
|
22
|
+
|
|
23
|
+
**2. Create a small Bell circuit** as `bell.qasm` (OpenQASM 2), or use the copy in **[`examples/circuits/bell.qasm`](examples/circuits/bell.qasm)** from a clone:
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
OPENQASM 2.0;
|
|
27
|
+
include "qelib1.inc";
|
|
28
|
+
qreg q[2];
|
|
29
|
+
creg c[2];
|
|
30
|
+
h q[0];
|
|
31
|
+
cx q[0],q[1];
|
|
32
|
+
measure q[0] -> c[0];
|
|
33
|
+
measure q[1] -> c[1];
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**3. Build preflight context** (heuristic resource guidance + optional structural taxonomy profiles):
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
qcoder context bell.qasm \
|
|
40
|
+
--out-json preflight.context.json \
|
|
41
|
+
--out-md preflight.context.md \
|
|
42
|
+
--guidance --profiles
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
From the repo root you can instead run:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
qcoder context examples/circuits/bell.qasm \
|
|
49
|
+
--out-json preflight.context.json \
|
|
50
|
+
--out-md preflight.context.md \
|
|
51
|
+
--guidance --profiles
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**4. Review with sample counts** (illustrative counts only—not produced by qCoder). From a **clone**, use the fixture **[`examples/fixtures/bell_counts_qiskit.json`](examples/fixtures/bell_counts_qiskit.json)**:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
qcoder review \
|
|
58
|
+
--counts-json examples/fixtures/bell_counts_qiskit.json \
|
|
59
|
+
--format qiskit_counts \
|
|
60
|
+
--preflight-json preflight.context.json \
|
|
61
|
+
--out-json execution.review.json \
|
|
62
|
+
--out-md execution.review.md
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
If you only have **`pip install`** and no **`examples/`** tree, write the same payload to a file and pass that path:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
printf '%s\n' '{"00": 5, "11": 3}' > counts.json
|
|
69
|
+
qcoder review \
|
|
70
|
+
--counts-json counts.json \
|
|
71
|
+
--format qiskit_counts \
|
|
72
|
+
--preflight-json preflight.context.json \
|
|
73
|
+
--out-json execution.review.json \
|
|
74
|
+
--out-md execution.review.md
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
In real use, **`counts.json`** comes from **your** simulator or hardware pipeline; qCoder only reads the file you pass in.
|
|
78
|
+
|
|
79
|
+
**Examples:** **[`examples/README.md`](examples/README.md)** (Bell QASM + illustrative counts for clones).
|
|
80
|
+
|
|
81
|
+
- **Free single-run intelligence** and **BYO LLM artifact workflow:** [`examples/06_single_run_intelligence.md`](examples/06_single_run_intelligence.md), [`examples/07_byo_llm_artifact_pack.md`](examples/07_byo_llm_artifact_pack.md), copy-paste prompt [`examples/prompts/single_run_artifact_to_action.md`](examples/prompts/single_run_artifact_to_action.md).
|
|
82
|
+
- Full walkthrough on the site: [Single-run intelligence with qCoder](https://qcoder.ai/manual/workflows/single-run-intelligence/).
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## What qCoder analyzes
|
|
87
|
+
|
|
88
|
+
qCoder summarizes **circuit structure** from OpenQASM (and optional framework export paths). Pair its JSON with **your** run data whenever you need **execution evidence**.
|
|
89
|
+
|
|
90
|
+
## Package layout (supported public surface)
|
|
91
|
+
|
|
92
|
+
**Current supported public surface:**
|
|
93
|
+
|
|
94
|
+
- **`qcoder analyze`** — single-circuit extraction (human or `--json`).
|
|
95
|
+
- **`qcoder batch`** — directory batch to **JSONL**.
|
|
96
|
+
- **Optional `--guidance`** on `analyze` / `batch` — deterministic heuristic starting points (shots and simulator/MPS settings) derived from circuit structure.
|
|
97
|
+
- **Optional `--profiles`** on **`qcoder context`** and on **`qcoder analyze --json`** — deterministic derived structural taxonomy from `feature_map` (additive, non-canonical). For **`analyze`**, use **`--json --profiles`** together.
|
|
98
|
+
- **`qcoder context`** — deterministic preflight context artifacts (**JSON + Markdown**), including optional `--guidance`, optional **`--profiles`**, and optional **`--full-features`** glossary appendix.
|
|
99
|
+
- **`qcoder review`** — deterministic post-run review artifacts (**JSON + Markdown**) from user-provided counts.
|
|
100
|
+
- **Counts intake normalization** — `qcoder.counts.v0` and `qiskit_counts` normalization into the same deterministic review path.
|
|
101
|
+
- **`qcoder[qiskit]`** — optional `QuantumCircuit` intake into the **same extractor** as OpenQASM.
|
|
102
|
+
- **`qcoder[cirq]`** — optional Cirq `Circuit` intake into the **same extractor** as OpenQASM.
|
|
103
|
+
- **`qcoder[pennylane]`** — optional PennyLane circuit intake into the **same extractor** as OpenQASM.
|
|
104
|
+
- **Documented feature output** — see [qcoder.ai — Feature reference](https://qcoder.ai/manual/feature-reference/) and `engines/feature_extraction/features/schema_v0.py`; JSON carries a **`schema_version`** alongside named fields.
|
|
105
|
+
|
|
106
|
+
The public package contains the documented deterministic free-product surface above.
|
|
107
|
+
|
|
108
|
+
Brief notes live in **`docs/architecture.md`**.
|
|
109
|
+
|
|
110
|
+
## Install (optional extras)
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pip install "qcoder[qiskit]"
|
|
114
|
+
pip install "qcoder[cirq]"
|
|
115
|
+
pip install "qcoder[pennylane]"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Machine-readable JSON from **`qcoder analyze --json`** includes a derived **`feature_map`** object (`name → value`) for easier reading. The canonical circuit feature bundle remains the nested **`features`** object (`schema_version`, **`feature_names`**, **`features`**).
|
|
119
|
+
|
|
120
|
+
Optional **`--guidance`** adds heuristic shot-count and simulator/MPS starting-point suggestions derived from structural features. These suggestions are transparent, non-guaranteed starting points only; qCoder performs no backend execution and includes no telemetry/upload in this flow. When a bundled local guidance pack is present, the guidance JSON may also include **`guidance_metadata`** (pack id/version/hash, shadow suggestions, explicit `fallback_used`) for BYO-LLM workflows; **deterministic** `pressure` / `starting_points` remain the user-visible values until a future release explicitly applies pack output.
|
|
121
|
+
|
|
122
|
+
Optional **`--profiles`** adds deterministic **`feature_profiles`** derived from `feature_map` for compact structural taxonomy. This is an additive interpretation layer with its own schema version and does not modify canonical `features` (`schema_version`, `feature_names`, `features`).
|
|
123
|
+
|
|
124
|
+
`qcoder context` and `qcoder review` generate deterministic local artifacts (JSON + Markdown) intended for user-controlled planning/review workflows. "LLM-ready/RAG-ready" in this project means users can attach or paste these artifacts manually; qCoder itself performs no retrieval, embeddings, network calls, or telemetry/upload in this flow.
|
|
125
|
+
|
|
126
|
+
The optional Qiskit, Cirq, and PennyLane adapters are structure/export intake paths only. qCoder does not execute simulators or hardware backends in these flows.
|
|
127
|
+
|
|
128
|
+
## CLI reference (other commands)
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
qcoder analyze path/to/circuit.qasm
|
|
132
|
+
qcoder analyze path/to/circuit.qasm --json
|
|
133
|
+
qcoder analyze path/to/circuit.qasm --json --guidance
|
|
134
|
+
qcoder analyze path/to/circuit.qasm --json --profiles
|
|
135
|
+
qcoder context path/to/circuit.qasm --out-json preflight.context.json --out-md preflight.context.md --guidance
|
|
136
|
+
qcoder context path/to/circuit.qasm --out-json preflight.context.json --out-md preflight.context.md --profiles
|
|
137
|
+
qcoder batch circuits --out batch.features.jsonl --pattern "*.qasm"
|
|
138
|
+
qcoder batch circuits --out batch.features.jsonl --pattern "*.qasm" --guidance
|
|
139
|
+
qcoder review --counts-json counts.json --format qiskit_counts --preflight-json preflight.context.json --out-json execution.review.json --out-md execution.review.md
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Batch:** JSONL records are written to **`--out`**. Status lines (for example record counts) may go to **stderr**, so prefer **`--out`** over shell stdout redirection for the JSONL stream.
|
|
143
|
+
|
|
144
|
+
## Develop / test (from a clone)
|
|
145
|
+
|
|
146
|
+
If you use **pyenv**, select the intended Python before creating the venv (for example `pyenv local 3.11.x` or `pyenv shell 3.11.x`) so `python -m venv` uses that interpreter.
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
python -m venv .venv
|
|
150
|
+
source .venv/bin/activate
|
|
151
|
+
pip install -e ".[qiskit]"
|
|
152
|
+
pip install pytest
|
|
153
|
+
pytest -q
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
Licensed under the **Apache License 2.0**. See `LICENSE` and `NOTICE`.
|
|
@@ -13,6 +13,7 @@ The supported product surface described in **`README.md`** (**Package layout**)
|
|
|
13
13
|
|
|
14
14
|
- **`qcoder analyze`** and **`qcoder batch`** for deterministic structural extraction output.
|
|
15
15
|
- Optional **`--guidance`** for deterministic heuristic starting points derived from `feature_map`.
|
|
16
|
+
- Optional **`--profiles`** on `analyze` / `context` for deterministic derived structural taxonomy from `feature_map`.
|
|
16
17
|
- **`qcoder context`** for deterministic preflight artifacts (**JSON + Markdown**), with optional `--full-features` glossary appendix.
|
|
17
18
|
- **`qcoder review`** for deterministic post-run review artifacts (**JSON + Markdown**) from user-provided counts.
|
|
18
19
|
- Counts normalization from **`qcoder.counts.v0`** and **`qiskit_counts`** into one deterministic review path.
|
|
@@ -20,8 +21,12 @@ The supported product surface described in **`README.md`** (**Package layout**)
|
|
|
20
21
|
|
|
21
22
|
The canonical circuit feature schema remains the existing `features` payload (`schema_version`, `feature_names`, `features`) produced by extraction. Guidance/context/review outputs are additive artifact layers and do not change canonical feature schema/version/order.
|
|
22
23
|
|
|
23
|
-
When requested via CLI flags, qCoder may emit an additional top-level `guidance` block built deterministically from `feature_map`. This guidance is outside the canonical feature schema (`features`) and is intended as transparent heuristic starting points rather than execution-validated recommendations.
|
|
24
|
+
When requested via CLI flags, qCoder may emit an additional top-level `guidance` block built deterministically from `feature_map`. This guidance is outside the canonical feature schema (`features`) and is intended as transparent heuristic starting points rather than execution-validated recommendations. The same block may include **`guidance_metadata`** describing a packaged **shadow-mode** local guidance JSON candidate (read from disk via `importlib.resources`; no network): pack id/version/content hash, optional shadow suggestions, and explicit fallback flags. **Deterministic** MPS `pressure` and `starting_points` stay authoritative in this slice; the pack does not override them yet.
|
|
25
|
+
|
|
26
|
+
qCoder may also emit an optional top-level `feature_profiles` block derived deterministically from `feature_map`. `feature_profiles` is additive, separately versioned (`feature_profiles_schema_version`), and does not alter canonical `features` schema/version/order.
|
|
24
27
|
|
|
25
28
|
The `context` and `review` commands generate deterministic local artifacts (Markdown/JSON) for user-controlled planning and post-run analysis workflows. "LLM-ready/RAG-ready" in this context means users can attach/paste artifacts manually; qCoder itself makes no LLM calls and performs no retrieval, embeddings, network calls, telemetry upload, or database writes. qCoder also does not execute simulators or hardware backends in these flows.
|
|
26
29
|
|
|
27
30
|
Optional framework adapters perform conversion/intake only; they do not execute circuits, simulators, or hardware.
|
|
31
|
+
|
|
32
|
+
The public package contains the documented deterministic free-product surface. Backend-specific runners, learned-prediction experiments, and private analysis prototypes are not part of the public package.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Model card — `resource_guidance_local_v0` (shadow / metadata only)
|
|
2
|
+
|
|
3
|
+
**Status:** Packaged as **candidate** JSON (`0.1.0-candidate`) in the public `qcoder` wheel under `qcoder.model_packs`. **Shadow mode only:** qCoder **does not** apply pack suggestions to `simulation_guidance.mps_bond_dimension.pressure` or `starting_points` in this release slice. Deterministic structural heuristics remain the user-visible source of truth.
|
|
4
|
+
|
|
5
|
+
## Data scope
|
|
6
|
+
|
|
7
|
+
- **Synthetic / public / qCoder-owned generated variants** only (as declared in the pack `training_data` block).
|
|
8
|
+
- **No** real user telemetry, **no** Pro/private workflow exports, **no** unaudited archive dumps.
|
|
9
|
+
|
|
10
|
+
## Runtime posture
|
|
11
|
+
|
|
12
|
+
- **Local** package data only (`importlib.resources`); **no** network calls, **no** hosted inference, **no** telemetry upload from this path.
|
|
13
|
+
- **No** runtime ML dependency (plain JSON; stdlib load and validate).
|
|
14
|
+
|
|
15
|
+
## Non-claims (machine-readable keys also appear in the pack JSON)
|
|
16
|
+
|
|
17
|
+
This pack and any shadow suggestions are **not**:
|
|
18
|
+
|
|
19
|
+
- an optimality proof (`not_optimality_proof`);
|
|
20
|
+
- a fidelity proof (`not_fidelity_proof`);
|
|
21
|
+
- hardware correctness proof (`not_hardware_correctness_proof`);
|
|
22
|
+
- a runtime guarantee (`not_runtime_guarantee`);
|
|
23
|
+
- backend ranking or universal QPU quality scoring (`not_backend_ranking`);
|
|
24
|
+
- causal savings or cost optimality (`not_causal_savings`).
|
|
25
|
+
|
|
26
|
+
## Behavior in qCoder today
|
|
27
|
+
|
|
28
|
+
- **Deterministic fallback preserved:** `build_resource_guidance` continues to set `pressure` and `starting_points` from structural scores only.
|
|
29
|
+
- **`guidance_metadata`:** additive block on the guidance dict documenting pack id/version/hash, `fallback_used`, and `shadow_guidance` with `applied: false` until a future evaluated release explicitly enables application.
|
|
30
|
+
|
|
31
|
+
## Promotion (future)
|
|
32
|
+
|
|
33
|
+
Public promotion requires evaluation gates, reproducible labels, and explicit product/API review before any **non-shadow** application of pack outputs.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "qcoder"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.4.0a2"
|
|
8
8
|
description = "Quantum circuit analysis and structured feature extraction tools."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -46,6 +46,9 @@ package-dir = {"" = "src"}
|
|
|
46
46
|
[tool.setuptools.packages.find]
|
|
47
47
|
where = ["src"]
|
|
48
48
|
|
|
49
|
+
[tool.setuptools.package-data]
|
|
50
|
+
qcoder = ["model_packs/*.json"]
|
|
51
|
+
|
|
49
52
|
[tool.pytest.ini_options]
|
|
50
53
|
pythonpath = ["src"]
|
|
51
54
|
|
|
@@ -30,10 +30,22 @@ def _cmd_analyze(argv: list[str]) -> int:
|
|
|
30
30
|
p.add_argument("--threshold", type=float, default=None, help="Optional threshold/bond-dim conditioning value")
|
|
31
31
|
p.add_argument("--mirror-artifacts-dir", default=None, metavar="DIR", help="If set, write mirror QASM to DIR and add adjoint_supported/adjoint_reason/mirror_qasm_ref to output")
|
|
32
32
|
p.add_argument("--guidance", action="store_true", help="Include heuristic resource guidance (shots and simulator/MPS starting points)")
|
|
33
|
+
p.add_argument(
|
|
34
|
+
"--profiles",
|
|
35
|
+
action="store_true",
|
|
36
|
+
help="Include derived feature_profiles in JSON output (requires --json for analyze)",
|
|
37
|
+
)
|
|
33
38
|
|
|
34
39
|
p.add_argument("--json", action="store_true", help="Emit machine-readable JSON")
|
|
35
40
|
args = p.parse_args(argv)
|
|
36
41
|
|
|
42
|
+
if args.profiles and not args.json:
|
|
43
|
+
print(
|
|
44
|
+
"qcoder: --profiles is currently emitted only with --json for analyze; use --json --profiles.",
|
|
45
|
+
file=sys.stderr,
|
|
46
|
+
)
|
|
47
|
+
return 2
|
|
48
|
+
|
|
37
49
|
report = analyze_qasm(
|
|
38
50
|
args.qasm,
|
|
39
51
|
circuit_id=args.circuit_id,
|
|
@@ -45,7 +57,13 @@ def _cmd_analyze(argv: list[str]) -> int:
|
|
|
45
57
|
)
|
|
46
58
|
|
|
47
59
|
if args.json:
|
|
48
|
-
print(
|
|
60
|
+
print(
|
|
61
|
+
json.dumps(
|
|
62
|
+
report.to_json_dict(include_guidance=args.guidance, include_profiles=args.profiles),
|
|
63
|
+
indent=2,
|
|
64
|
+
sort_keys=True,
|
|
65
|
+
)
|
|
66
|
+
)
|
|
49
67
|
return 0
|
|
50
68
|
|
|
51
69
|
ex = report.example
|
|
@@ -62,7 +80,7 @@ def _cmd_analyze(argv: list[str]) -> int:
|
|
|
62
80
|
print(f"schema: {fv.schema_version}")
|
|
63
81
|
print(f"n_features: {len(fv.features)}")
|
|
64
82
|
if args.guidance:
|
|
65
|
-
out = report.to_json_dict(include_guidance=True)
|
|
83
|
+
out = report.to_json_dict(include_guidance=True, include_profiles=args.profiles)
|
|
66
84
|
guidance = out.get("guidance", {})
|
|
67
85
|
shot = guidance.get("shot_guidance", {})
|
|
68
86
|
sim = guidance.get("simulation_guidance", {})
|
|
@@ -122,6 +140,11 @@ def _cmd_context(argv: list[str]) -> int:
|
|
|
122
140
|
p.add_argument("--id", dest="circuit_id", default=None, help="Optional circuit id")
|
|
123
141
|
p.add_argument("--name", dest="circuit_name", default=None, help="Optional circuit name")
|
|
124
142
|
p.add_argument("--guidance", action="store_true", help="Include heuristic resource guidance in context artifacts")
|
|
143
|
+
p.add_argument(
|
|
144
|
+
"--profiles",
|
|
145
|
+
action="store_true",
|
|
146
|
+
help="Include deterministic derived feature profiles in context artifacts",
|
|
147
|
+
)
|
|
125
148
|
p.add_argument(
|
|
126
149
|
"--full-features",
|
|
127
150
|
action="store_true",
|
|
@@ -134,6 +157,7 @@ def _cmd_context(argv: list[str]) -> int:
|
|
|
134
157
|
out_json=args.out_json,
|
|
135
158
|
out_md=args.out_md,
|
|
136
159
|
include_guidance=args.guidance,
|
|
160
|
+
include_profiles=args.profiles,
|
|
137
161
|
include_full_features=args.full_features,
|
|
138
162
|
circuit_id=args.circuit_id,
|
|
139
163
|
circuit_name=args.circuit_name,
|
|
@@ -30,7 +30,7 @@ def normalize_precision(x: str | None) -> str:
|
|
|
30
30
|
@dataclass(frozen=True)
|
|
31
31
|
class RunConfig:
|
|
32
32
|
"""
|
|
33
|
-
|
|
33
|
+
User-supplied run context for analyze reports.
|
|
34
34
|
|
|
35
35
|
These are NOT circuit-derived features.
|
|
36
36
|
"""
|
|
@@ -38,10 +38,6 @@ class RunConfig:
|
|
|
38
38
|
backend: str # normalized: "CPU" | "GPU"
|
|
39
39
|
precision: str # normalized: "single" | "double"
|
|
40
40
|
threshold: float | None = None # e.g. bond-dimension/threshold conditioning
|
|
41
|
-
prediction_artifact_path: str | None = None
|
|
42
|
-
prediction_allow_schema_mismatch: bool = False
|
|
43
|
-
prediction_fidelity_target: float | None = None
|
|
44
|
-
prediction_fidelity_metric: str | None = None
|
|
45
41
|
|
|
46
42
|
@staticmethod
|
|
47
43
|
def from_raw(
|
|
@@ -50,10 +46,6 @@ class RunConfig:
|
|
|
50
46
|
backend: str | None = None,
|
|
51
47
|
precision: str | None = None,
|
|
52
48
|
threshold: float | None = None,
|
|
53
|
-
prediction_artifact_path: str | None = None,
|
|
54
|
-
prediction_allow_schema_mismatch: bool | None = None,
|
|
55
|
-
prediction_fidelity_target: float | None = None,
|
|
56
|
-
prediction_fidelity_metric: str | None = None,
|
|
57
49
|
) -> "RunConfig":
|
|
58
50
|
# accept processor OR backend as the same input channel
|
|
59
51
|
raw = processor if processor is not None else backend
|
|
@@ -65,10 +57,6 @@ class RunConfig:
|
|
|
65
57
|
backend=normalize_backend(raw or backend),
|
|
66
58
|
precision=normalize_precision(precision),
|
|
67
59
|
threshold=float(threshold) if threshold is not None else None,
|
|
68
|
-
prediction_artifact_path=prediction_artifact_path,
|
|
69
|
-
prediction_allow_schema_mismatch=prediction_allow_schema_mismatch or False,
|
|
70
|
-
prediction_fidelity_target=prediction_fidelity_target,
|
|
71
|
-
prediction_fidelity_metric=prediction_fidelity_metric,
|
|
72
60
|
)
|
|
73
61
|
|
|
74
62
|
def to_dict(self) -> dict:
|
|
@@ -77,8 +65,4 @@ class RunConfig:
|
|
|
77
65
|
"backend": self.backend,
|
|
78
66
|
"precision": self.precision,
|
|
79
67
|
"threshold": self.threshold,
|
|
80
|
-
"prediction_artifact_path": self.prediction_artifact_path,
|
|
81
|
-
"prediction_allow_schema_mismatch": self.prediction_allow_schema_mismatch,
|
|
82
|
-
"prediction_fidelity_target": self.prediction_fidelity_target,
|
|
83
|
-
"prediction_fidelity_metric": self.prediction_fidelity_metric,
|
|
84
68
|
}
|
|
@@ -22,11 +22,26 @@ def qasm_sha256(path: str) -> str:
|
|
|
22
22
|
return hashlib.sha256(data).hexdigest()
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
def context_bundle_basis(analysis: dict[str, Any]) -> str:
|
|
26
|
+
"""Human-readable bundle basis from which optional blocks are included."""
|
|
27
|
+
has_g = "guidance" in analysis
|
|
28
|
+
has_p = "feature_profiles" in analysis
|
|
29
|
+
if has_g and has_p:
|
|
30
|
+
return "deterministic_analysis_plus_guidance_and_profiles"
|
|
31
|
+
if has_g:
|
|
32
|
+
return "deterministic_analysis_plus_guidance"
|
|
33
|
+
if has_p:
|
|
34
|
+
return "deterministic_analysis_plus_profiles"
|
|
35
|
+
return "deterministic_analysis"
|
|
36
|
+
|
|
37
|
+
|
|
25
38
|
def analysis_fingerprint(analysis: dict[str, Any]) -> str:
|
|
26
39
|
canonical = {
|
|
27
40
|
"features": analysis.get("features", {}),
|
|
28
41
|
"feature_map": analysis.get("feature_map", {}),
|
|
29
42
|
}
|
|
43
|
+
if "feature_profiles" in analysis:
|
|
44
|
+
canonical["feature_profiles"] = analysis.get("feature_profiles", {})
|
|
30
45
|
raw = json.dumps(canonical, sort_keys=True, separators=(",", ":")).encode("utf-8")
|
|
31
46
|
return hashlib.sha256(raw).hexdigest()
|
|
32
47
|
|
|
@@ -58,11 +73,22 @@ def build_context_bundle(
|
|
|
58
73
|
}
|
|
59
74
|
if "guidance" in analysis:
|
|
60
75
|
analysis_block["guidance"] = analysis["guidance"]
|
|
76
|
+
if "feature_profiles" in analysis:
|
|
77
|
+
analysis_block["feature_profiles"] = analysis["feature_profiles"]
|
|
78
|
+
|
|
79
|
+
llm_limits = [
|
|
80
|
+
"Do not interpret this artifact as simulator or hardware execution evidence.",
|
|
81
|
+
"Guidance is heuristic and non-guaranteed when present.",
|
|
82
|
+
]
|
|
83
|
+
if "feature_profiles" in analysis:
|
|
84
|
+
llm_limits.append(
|
|
85
|
+
"Feature profiles are deterministic structural taxonomy, not execution evidence."
|
|
86
|
+
)
|
|
61
87
|
|
|
62
88
|
return {
|
|
63
89
|
"context_bundle_schema_version": "0.1",
|
|
64
90
|
"artifact_type": "qcoder.preflight_context",
|
|
65
|
-
"basis":
|
|
91
|
+
"basis": context_bundle_basis(analysis),
|
|
66
92
|
"generated_utc": generated_utc or utc_now_iso(),
|
|
67
93
|
"qcoder_version": qcoder_version,
|
|
68
94
|
"circuit": circuit,
|
|
@@ -77,10 +103,7 @@ def build_context_bundle(
|
|
|
77
103
|
],
|
|
78
104
|
"llm_use": {
|
|
79
105
|
"intended_use": "Attach or paste this artifact for AI-assisted circuit planning.",
|
|
80
|
-
"limits":
|
|
81
|
-
"Do not interpret this artifact as simulator or hardware execution evidence.",
|
|
82
|
-
"Guidance is heuristic and non-guaranteed when present.",
|
|
83
|
-
],
|
|
106
|
+
"limits": llm_limits,
|
|
84
107
|
},
|
|
85
108
|
}
|
|
86
109
|
|