PYPI PACKAGE AUDIT v0.35.1 Enterprise Healthy

openqml

Quantum-classical hybrid AI, quantitative research and cross-framework quantum programming

PyPkgScore openqml
Methodology & Criteria ♥ Donate
870 / 1000
Quick Install
pip install openqml
1. Governance
200/200
2. PEP Metadata
200/200
3. Security
200/200
4. Docs & SEO
105/200
5. CI Engineering
165/200
📣 Share Audit: Share this report and visual preview in the current language
Advertisement
PYPI TELEMETRY

Downloads & Community Adoption

Last 30 days (without mirrors)
Last 7 days
553
Last 30 days
3696
Total (180 days)
3696
Metric / Ecosystem Status / Value Source
Downloads (30d / 180d) — PyPI Stats (without mirrors)
Trusted Publishing (PEP 740) ✓ Verified OIDC PyPI Integrity / Sigstore
Django Packages — djangopackages.org
PyTech / PyPkgScore 870 / 1000 PyPkgScore Engine

Health & Engineering Analysis (5 Pillars)

1. Governance & Community200 / 200 ▾
LICENSE✓ 50 pts
SECURITY.md✓ 50 pts
CONTRIBUTING.md✓ 50 pts
CODE_OF_CONDUCT.md✓ 50 pts
2. PEP Metadata & Packaging200 / 200 ▾
Wheel (.whl)✓ 50 pts
pyproject.toml✓ 50 pts
Project URLs✓ 50 pts
Trove Classifiers✓ 50 pts
3. Security & Supply Chain200 / 200 ▾
Zero CVEs (OSV)✓ 60 pts
Trusted Publishing (OIDC)✓ 50 pts
Snyk / Audit Link✓ 40 pts
HTTPS Repository✓ 50 pts
4. Documentation, SEO & Ecosystem105 / 200 ▾
Structured README✓ 60 pts
Read the Docs✕ 0 pts
Django Packages✕ 0 pts
Website / Technical Articles✓ 45 pts
5. Engineering, CI & Quality165 / 200 ▾
Automated Tests✓ 65 pts
GitHub Actions CI✓ 65 pts
CHANGELOG.md✓ 35 pts
Env & Lockfile (uv/rye/poetry/pdm/hatch)✕ 0 pts
Advertisement
README & DOCS

Official Documentation & Usage Guide — openqml

PyPI Metadata v0.35.1
Show full original documentation (English README) ▾

OpenQML

PyPI · Documentation · Changes · CI

Contributing · Governance · Security

OpenQML can choose tensor-network bond ranks from the accuracy a caller needs in a measured expectation, a class margin, a weight gradient or a discounted price. Each result carries the achieved truncation bound in the requested units. Readout accuracy and execution

Quantum–classical hybrid AI

Build and train hybrid neural networks with PyTorch, JAX or Flax. Use Model.fit and predict for supervised tasks, or compose convolution, attention, graph, recurrent and generative architectures with native layers. Validation loss, early stopping and portable checkpoints keep model selection and continued training in the same workflow. Explore hybrid AI.

Train native quantum blocks with resumable, distance-aware Quantum Natural Muon and classical blocks with AdamW through one hybrid_qnm optimizer. Microbatch accumulation and DDP share an empirical, matrix-free quantum Fisher metric. Sample chunking bounds the active state workspace during geometry products. Noisy and dynamic circuits use regularized density-state Fisher geometry with implicit Sylvester derivatives, including repeated density eigenvalues. External Torch/JAX layers can pack forward and parameter-shift rows into one provider submission and reuse their linearization during backward.

LindbladPlan and native PyTorch/Flax LindbladLayer learn continuous-time coherent and dissipative dynamics. Exact local CPTP maps preserve density constraints, while explicit discretization and generator-uncertainty bounds quantify the modeled readout error. Sparse Pauli transfer layers also train standard local noise probabilities directly from batched readouts.

Quantum–classical hybrid quantitative research

Train scenario distributions, allocate constrained portfolios and project decisions onto explicit CVaR budgets with a funded cash position. Low-rank factor solves and native PyTorch/JAX derivatives connect financial objectives to hybrid models. Purged walk-forward refits and self-financing accounting preserve chronological evaluation, execution delays, fees and market impact. Explore quantitative research.

Learn scenario probabilities, Wasserstein radii and anisotropic transport metrics. ScenarioPlan.execution_loss connects proper-score calibration to after-cost decisions. Exact piecewise quadratic projections fund proportional fees and market impact while enforcing CVaR or expectile budgets. ScenarioPlan.tree adds funded multi-stage policies and nested conditional risk. MultiPeriodPlan couples forecast-horizon decisions through turnover costs. ScenarioPlan.horizon_decision differentiates those decisions through predicted path probabilities without constructing a dense horizon KKT matrix. TailAllocationPlan jointly optimizes path CVaR, Wasserstein robustness and multi-period rebalancing with implicit first and higher derivatives. ScenarioPlan.tail_decision connects this optimizer to learned Born probabilities. EVaR execution budgets and asset-level tail-risk contributions use the same scenario distributions.

Cross-framework quantum programming

Connect Qiskit, Cirq, PennyLane and OpenQASM through a shared circuit representation. Compile grouped switch cases, finite loops and atomic classical guards; reuse shared definitions and symbolic expressions. Prepare conversions once, stream parameter sweeps and verify their semantics against round-trip or native execution. Explore interoperability.

Typed Qiskit logical, bitwise and unsigned comparison predicates lower to bounded shared decision graphs. Their branch selection completes before either payload executes, including payloads that overwrite a measured predicate input. Fixed-width unsigned arithmetic includes division with symbolically proved nonzero divisors. Correlated selector proofs admit bounded dynamic shifts and bit indexing while preserving atomic branch selection. Deferred Qiskit inverses, controls and numeric powers expand through the same checked conversion routes. Finite loops with break and continue preserve measurement feedback, nested exit targets and entry-time branch selection under explicit expansion budgets. Bool/Uint variables and runtime assignments lower to explicit classical storage in IR v5. Shared snapshots preserve overlapping assignments; liveness analysis merges overwritten records without allocating additional qubits. Optional affine phase folding combines diagonal rotations while preserving branch-local phase.

Simulate physical noise with amplitude/phase damping, depolarization and custom Kraus channels. Correct independent readout errors or extrapolate measured noise scales with explicit conditioning and sampling-overhead limits. Caller-initialized Qiskit V2 primitives connect real hardware; see execution limits and mitigation.

Install

Python 3.10 or later:

python -m pip install -U openqml

The core depends on NumPy, packaging and psutil. Training frameworks, quantum SDKs and execution engines load on demand. Install the integrations you use, such as openqml[torch], openqml[jax], openqml[flax] or openqml[qiskit,cirq].

Install openqml[gpu] on Linux x86-64 for the OpenQML statevector kernels on NVIDIA CUDA. The same circuit IR drives GPU simulation, differentiable PyTorch and JAX training, tensor-network readouts and asynchronous Qiskit V2 QPU jobs. See GPU and QPU execution.

Quick start

Allocate from observed returns:

import openqml as oq

returns = [[0.01, -0.02], [-0.01, 0.03], [0.02, 0.01]]
portfolio = oq.finance.allocate(returns, caps=0.7, fees=0.001)
print(portfolio.weights)

Train a hybrid model after installing openqml[torch]:

import openqml as oq

x = [[0.0, 0.0], [0.0, 1.0], [1.0, 0.0], [1.0, 1.0]] * 8
y = [0, 1, 1, 0] * 8
model = oq.Model(task="classification", hidden_features=8, depth=2)
model.fit(x, y, epochs=10)
print(model.predict(x[:2]))

Select framework="jax" or framework="flax" to change training frameworks. backend chooses circuit execution; device chooses native tensor placement. Qubit counts follow the selected backend's available resources.

Export a six-qubit trainable circuit with an explicit CX chain:

import openqml as oq

layer = oq.hardware_efficient(6, depth=1, wire_order=(0, 4, 1, 3, 2, 5))
circuit = layer.circuit.rx(0.31, 5)
result = oq.convert(circuit, target="openqasm3")
print(result.value)

convert imports, checks and exports in one call. Native SDK targets require their corresponding integration. Use plan_conversion when repeatedly binding or exporting the same source.

Hybrid models, financial operators and circuit execution share a native compute kernel. It centralizes array placement, matrix products, contraction planning, numerical checks and memory admission. Configure a common workspace ceiling for an isolated execution scope:

import openqml as oq

with oq.compute_context(policy=oq.ComputePolicy(max_memory_mb=512)):
    result = oq.expectations(oq.Circuit(1).h(0), [oq.PauliString("Z")])

Use compile_compute for checked Torch/JAX compilation. Iterative solves certify their true residual before returning a solution. Operation-specific budgets remain available. Shared caches hold bounded, immutable planning metadata; trainable tensors stay in each forward pass. Compute policies and numerical contracts.

Circuit.append shares immutable prefix chunks. Local NumPy execution fuses single/two-wire gate groups and applies them through tensor views. Use compile_circuit to compile a complete native circuit and its declared readouts. Implementations are organized in responsibility packages; the root API and published module imports remain available.

API · Training and validation · Quantitative research · Interoperability · Runtime

License

Apache-2.0