Sansqrit: a simplified quantum DSL with sparse, sharded, stabilizer, MPS, hybrid, noisy, GPU and distributed backends.
Project description
Sansqrit Python
Sansqrit is a simplified quantum-computing DSL and Python package for scientists, engineers, educators, and AI/ML systems that need readable quantum programs. It is designed around a compact .sq language with Python-like expressions, direct quantum gate calls, sparse-state simulation, sharding, precomputed lookups, stabilizer simulation for Clifford circuits, tensor-network/MPS simulation for low-entanglement circuits, noisy density-matrix simulation, optional GPU execution, and cluster-distributed sparse execution.
Sansqrit has two goals:
- Make quantum programs easy to read and write.
- Provide a high-quality training corpus for AI tools that need to learn quantum DSL syntax, quantum program patterns, backend selection, and simulator limitations.
Important physical limit: Sansqrit can address 150, 1,000, or more logical qubits when the backend and circuit structure support it. It cannot store an arbitrary dense state with
2^150amplitudes on local hardware. Large-qubit examples in this package deliberately use sparse, Clifford, or low-entanglement structure.
Package contents
src/sansqrit/: installable Python package.examples/: 250 executable Sansqrit DSL programs.src/sansqrit/examples/: packaged copy of the same examples for wheel users and AI tooling.docs/DSL_REFERENCE.md: syntax, gates, algorithms, and runtime reference.docs/ADVANCED_BACKENDS.md: stabilizer, MPS, hybrid, density, GPU, and cluster backends.docs/PROGRAM_CORPUS_250.md: every example program embedded in one Markdown corpus.docs/AI_TRAINING_GUIDE.md: recommended training/instruction-tuning format.docs/PUBLISHING.md: PyPI/TestPyPI publishing procedure.tests/: smoke tests and backend correctness checks.scripts/: validation scripts for examples and packaging.
Installation
Install from the source checkout:
python -m pip install sansqrit.
Install optional backends:
python -m pip install '.[tensor]' # NumPy MPS/tensor backend
python -m pip install '.[gpu]' # CuPy/CUDA GPU backend
python -m pip install '.[qiskit]' # Qiskit interop
python -m pip install '.[cirq]' # Cirq interop
python -m pip install '.[braket]' # Amazon Braket interop
python -m pip install '.[pennylane]' # PennyLane interop
python -m pip install '.[all]' # all optional non-GPU extras except CuPy where available
For development:
python -m pip install -e '.[dev,tensor,interop]'
pytest
python scripts/compile_all_examples.py
python scripts/run_all_examples.py
CLI tutorial
Run a DSL program:
sansqrit run examples/001_bell_state.sq
Translate DSL to Python:
sansqrit translate examples/001_bell_state.sq
Export a program to QASM:
sansqrit qasm examples/001_bell_state.sq --version 3
sansqrit qasm examples/001_bell_state.sq --version 2
Run the package as a module:
python -m sansqrit run examples/001_bell_state.sq
First Sansqrit program
simulate(2, seed=7) {
let q = quantum_register(2)
H(q[0])
CNOT(q[0], q[1])
print(probabilities(q))
print(measure_all(q, shots=1000))
}
What happens:
simulate(2)creates a two-qubit engine.quantum_register(2)returns indexable qubit referencesq[0]andq[1].H(q[0])creates a superposition on qubit 0.CNOT(q[0], q[1])entangles the two qubits.probabilitiesreturns exact probabilities when the backend supports enumeration.measure_allsamples shot counts.
150-qubit real-time application pattern
The safe way to use 150 logical qubits on local hardware is to keep the state sparse or structured. This example models a streaming telemetry alert that touches only a few decision qubits while preserving a 150-qubit address space.
simulate(150, engine="sharded", n_shards=16, workers=4, seed=150) {
let q = quantum_register(150)
X(q[12]) # incoming sensor flag
X(q[77]) # device-region flag
H(q[0]) # two-branch hypothesis bit
CNOT(q[0], q[149]) # copy branch into high-index alert qubit
Rz(q[149], PI / 32) # phase-tag alert branch
print("nonzero amplitudes", engine_nnz())
print(measure_all(q, shots=8))
}
Avoid this on a sparse local simulator unless you truly intend to create a dense state:
simulate(150) {
H_all() # expands to 2^150 amplitudes on sparse/dense state-vector backends
}
Use engine="stabilizer" for huge Clifford-only circuits, engine="mps" for low-entanglement chains, and engine="sharded" for sparse high-index applications.
DSL syntax reference
Comments
# single-line comment
Variables
let shots = 1024
const pi2 = PI / 2
name = "experiment"
let and const are readability keywords. They translate to Python assignments.
Literals
let i = 42
let f = 3.14
let b = true
let n = null
let s = "hello"
let xs = [1, 2, 3]
let pair = ("H", 0)
let meta = {"backend": "sparse", "shots": 100}
Constants
PI
TAU
E
HBAR
PLANCK
LIGHT_SPEED
BOLTZMANN
AVOGADRO
Arithmetic and Boolean logic
let x = (a + b) * c / 2
let y = x ** 2
let flag = x > 0 and y < 10
Control flow
if score > threshold {
print("accept")
} else if score == threshold {
print("borderline")
} else {
print("reject")
}
for i in range(4) {
print(i)
}
while error > 1e-6 {
error = error / 2
}
Functions
fn square(x) {
return x * x
}
let double = fn(x) => x * 2
Pipelines
let xs = [1, 2, 3, 4]
let squares = xs |> map(fn(x) => x * x)
let evens = xs |> filter(fn(x) => x % 2 == 0)
let total = xs |> reduce(fn(a, b) => a + b)
let total2 = xs |> sum
File I/O
write_file("out.txt", "hello")
let text = read_file("out.txt")
write_json("run.json", {"shots": 100})
let cfg = read_json("run.json")
write_csv("table.csv", [{"name": "a", "value": 1}])
let rows = read_csv("table.csv")
Quantum gate syntax
Single-qubit gates:
I(q[0])
X(q[0])
Y(q[0])
Z(q[0])
H(q[0])
S(q[0])
Sdg(q[0])
T(q[0])
Tdg(q[0])
SX(q[0])
SXdg(q[0])
Rx(q[0], PI / 2)
Ry(q[0], PI / 2)
Rz(q[0], PI / 2)
Phase(q[0], PI / 4)
U1(q[0], theta)
U2(q[0], phi, lam)
U3(q[0], theta, phi, lam)
Two-qubit gates:
CNOT(q[0], q[1])
CX(q[0], q[1])
CZ(q[0], q[1])
CY(q[0], q[1])
CH(q[0], q[1])
CSX(q[0], q[1])
SWAP(q[0], q[1])
iSWAP(q[0], q[1])
SqrtSWAP(q[0], q[1])
fSWAP(q[0], q[1])
DCX(q[0], q[1])
CRx(q[0], q[1], theta)
CRy(q[0], q[1], theta)
CRz(q[0], q[1], theta)
CP(q[0], q[1], theta)
CU(q[0], q[1], theta, phi, lam)
RXX(q[0], q[1], theta)
RYY(q[0], q[1], theta)
RZZ(q[0], q[1], theta)
RZX(q[0], q[1], theta)
ECR(q[0], q[1])
MS(q[0], q[1])
Three and multi-qubit gates:
Toffoli(q[0], q[1], q[2])
CCX(q[0], q[1], q[2])
Fredkin(q[0], q[1], q[2])
CSWAP(q[0], q[1], q[2])
CCZ(q[0], q[1], q[2])
MCX(q[0], q[1], q[2], q[3])
MCZ(q[0], q[1], q[2], q[3])
C3X(q[0], q[1], q[2], q[3])
C4X(q[0], q[1], q[2], q[3], q[4])
Bulk helpers:
H_all()
Rx_all(PI / 3)
Ry_all(PI / 4)
Rz_all(PI / 5)
qft()
iqft()
Measurement and state inspection:
measure(q[0])
measure_all(q, shots=1000)
probabilities(q)
expectation_z(q[0])
expectation_zz(q[0], q[1])
engine_nnz()
shards()
export_qasm2("circuit.qasm")
export_qasm3("circuit.qasm3")
Backend guide
| Backend | Use for | Strength | Limitation | Example |
|---|---|---|---|---|
sparse |
default sparse state-vector simulation | high-index sparse circuits | dense superpositions grow exponentially | simulate(40, engine="sparse") |
sharded |
sparse state split into local shards | inspection and parallel-friendly partitioning | not a substitute for avoiding dense states | simulate(150, engine="sharded", n_shards=16) |
threaded |
large sparse single-qubit transforms | parallel update path | Python overhead and GIL still matter | simulate(30, engine="threaded", workers=4) |
stabilizer |
Clifford-only circuits | thousands of qubits | rejects non-Clifford gates | simulate(4096, engine="stabilizer") |
mps |
low-entanglement chains | many qubits with bounded bond dimension | high entanglement increases bond size | simulate(80, engine="mps", max_bond_dim=64) |
density |
noisy small systems | noise channels and mixed states | matrix size grows as 4^n | simulate(4, engine="density") |
gpu |
dense GPU state vector | fast dense linear algebra where CUDA/CuPy is available | GPU memory still exponential | simulate(24, engine="gpu") |
distributed |
TCP worker sparse cluster | multi-node sparse partitions | correctness-first, not MPI-grade HPC | simulate(20, engine="distributed", addresses=[...]) |
hybrid |
route by circuit structure | avoid expansion when possible | experimental policy backend | see docs |
Precomputed lookup tables
Static one-qubit gates use lookup matrices by default: I, X, Y, Z, H, S, Sdg, T, Tdg, SX, SXdg. Parameterized gates are computed from formulas.
from sansqrit import QuantumEngine
engine = QuantumEngine.create(5, use_lookup=True)
Algorithms
Algorithm helpers are available in DSL and Python.
print(grover_search(4, 9, shots=256, seed=1))
print(grover_search_multi(5, [3, 12], shots=256, seed=2))
print(qaoa_maxcut(4, [(0,1), (1,2), (2,3), (3,0)], p=1, shots=128))
print(vqe_h2(0.735, max_iter=32))
print(quantum_phase_estimation(0.3125, 4, shots=128))
print(hhl_solve([[1.0, 0.0], [0.0, 2.0]], [1.0, 0.5]))
print(bernstein_vazirani("101101"))
print(deutsch_jozsa(5, "balanced"))
print(simon_algorithm("1101"))
print(quantum_counting(8, 13, 5))
print(amplitude_estimation(0.18, 5))
print(bb84_qkd(16, seed=11))
print(teleport())
print(superdense_coding("10"))
These reference algorithms are written for education, examples, and training corpora. For hardware-calibrated production workflows, export QASM or use the interop adapters.
Python API tutorial
from sansqrit import QuantumEngine, Circuit, run_code
engine = QuantumEngine.create(3, backend="sparse", seed=3)
engine.H(0)
engine.CNOT(0, 1)
engine.CNOT(1, 2)
print(engine.probabilities())
circuit = Circuit(2)
circuit.H(0).CNOT(0, 1)
print(circuit.export_qasm3())
program = """
simulate(2) {
H(0)
CNOT(0, 1)
print(measure_all(shots=10))
}
"""
run_code(program)
Interoperability
Sansqrit can export OpenQASM 2 and OpenQASM 3 from the DSL and Python circuits. Optional adapters are provided for Qiskit, Cirq, Amazon Braket, and PennyLane.
from sansqrit import Circuit
from sansqrit.interop import to_qiskit, to_cirq, to_braket
c = Circuit(2).H(0).CNOT(0, 1)
qiskit_circuit = to_qiskit(c)
cirq_circuit = to_cirq(c)
braket_circuit = to_braket(c)
Formal verification helpers compare Sansqrit output against available external simulators when optional dependencies are installed.
AI/ML training guidance
This repository intentionally includes redundant but useful learning signals:
- Natural-language tutorials in
README.mdanddocs/. - Short and long code examples in
examples/. - A single corpus file,
docs/PROGRAM_CORPUS_250.md, containing all programs. - Paired intent/code comments in many examples.
- Backend selection examples that teach when not to expand a dense state.
Recommended instruction-tuning pair:
{
"instruction": "Write a Sansqrit program that creates a Bell state and samples it.",
"answer": "simulate(2) {\n H(0)\n CNOT(0, 1)\n print(measure_all(shots=1000))\n}"
}
Do not train models to claim that arbitrary 150-qubit dense states are feasible on local hardware. Teach the distinction between logical addressability and physical dense-state storage.
250 example programs
The package contains 250 .sq programs. The full source is available in examples/ and docs/PROGRAM_CORPUS_250.md.
001_bell_state.sq— 001 bell state002_ghz_chain_8.sq— 002 ghz chain 8003_qft_three_qubits.sq— 003 qft three qubits004_inverse_qft_roundtrip.sq— 004 inverse qft roundtrip005_sharded_bell.sq— 005 sharded bell006_threaded_superposition.sq— 006 threaded superposition007_lookup_sx_inverse.sq— 007 lookup sx inverse008_toffoli_adder_bit.sq— 008 toffoli adder bit009_fredkin_swap.sq— 009 fredkin swap010_rzz_entangler.sq— 010 rzz entangler011_ms_gate.sq— 011 ms gate012_qasm_export.sq— 012 qasm export013_pipeline_statistics.sq— 013 pipeline statistics014_classical_function.sq— 014 classical function015_json_csv_io.sq— 015 json csv io016_grover_search.sq— 016 grover search017_grover_multi.sq— 017 grover multi018_bernstein_vazirani.sq— 018 bernstein vazirani019_deutsch_jozsa_balanced.sq— 019 deutsch jozsa balanced020_deutsch_jozsa_constant.sq— 020 deutsch jozsa constant021_qaoa_triangle.sq— 021 qaoa triangle022_qaoa_square.sq— 022 qaoa square023_vqe_h2.sq— 023 vqe h2024_phase_estimation.sq— 024 phase estimation025_hhl_2x2.sq— 025 hhl 2x2026_teleport_one.sq— 026 teleport one027_superdense_coding.sq— 027 superdense coding028_bb84_qkd.sq— 028 bb84 qkd029_bb84_with_eavesdropper.sq— 029 bb84 with eavesdropper030_shor_factor_15.sq— 030 shor factor 15031_amplitude_estimation.sq— 031 amplitude estimation032_quantum_counting.sq— 032 quantum counting033_variational_classifier.sq— 033 variational classifier034_variational_pattern_34.sq— 034 variational pattern 34035_variational_pattern_35.sq— 035 variational pattern 35036_variational_pattern_36.sq— 036 variational pattern 36037_variational_pattern_37.sq— 037 variational pattern 37038_variational_pattern_38.sq— 038 variational pattern 38039_variational_pattern_39.sq— 039 variational pattern 39040_variational_pattern_40.sq— 040 variational pattern 40041_variational_pattern_41.sq— 041 variational pattern 41042_variational_pattern_42.sq— 042 variational pattern 42043_variational_pattern_43.sq— 043 variational pattern 43044_variational_pattern_44.sq— 044 variational pattern 44045_variational_pattern_45.sq— 045 variational pattern 45046_variational_pattern_46.sq— 046 variational pattern 46047_variational_pattern_47.sq— 047 variational pattern 47048_variational_pattern_48.sq— 048 variational pattern 48049_variational_pattern_49.sq— 049 variational pattern 49050_variational_pattern_50.sq— 050 variational pattern 50051_variational_pattern_51.sq— 051 variational pattern 51052_variational_pattern_52.sq— 052 variational pattern 52053_variational_pattern_53.sq— 053 variational pattern 53054_variational_pattern_54.sq— 054 variational pattern 54055_variational_pattern_55.sq— 055 variational pattern 55056_variational_pattern_56.sq— 056 variational pattern 56057_variational_pattern_57.sq— 057 variational pattern 57058_variational_pattern_58.sq— 058 variational pattern 58059_variational_pattern_59.sq— 059 variational pattern 59060_variational_pattern_60.sq— 060 variational pattern 60061_variational_pattern_61.sq— 061 variational pattern 61062_variational_pattern_62.sq— 062 variational pattern 62063_variational_pattern_63.sq— 063 variational pattern 63064_variational_pattern_64.sq— 064 variational pattern 64065_variational_pattern_65.sq— 065 variational pattern 65066_variational_pattern_66.sq— 066 variational pattern 66067_variational_pattern_67.sq— 067 variational pattern 67068_variational_pattern_68.sq— 068 variational pattern 68069_variational_pattern_69.sq— 069 variational pattern 69070_variational_pattern_70.sq— 070 variational pattern 70071_phase_kickback.sq— 071 phase kickback072_hidden_shift.sq— 072 hidden shift073_qft_phase_grid.sq— 073 qft phase grid074_entangled_ladder.sq— 074 entangled ladder075_hardware_efficient_ansatz.sq— 075 hardware efficient ansatz076_maxcut_ansatz.sq— 076 maxcut ansatz077_qml_feature_map.sq— 077 qml feature map078_controlled_rotation_bank.sq— 078 controlled rotation bank079_multi_control_demo.sq— 079 multi control demo080_sparse_large_index.sq— 080 sparse large index081_phase_kickback.sq— 081 phase kickback082_hidden_shift.sq— 082 hidden shift083_qft_phase_grid.sq— 083 qft phase grid084_entangled_ladder.sq— 084 entangled ladder085_hardware_efficient_ansatz.sq— 085 hardware efficient ansatz086_maxcut_ansatz.sq— 086 maxcut ansatz087_qml_feature_map.sq— 087 qml feature map088_controlled_rotation_bank.sq— 088 controlled rotation bank089_multi_control_demo.sq— 089 multi control demo090_sparse_large_index.sq— 090 sparse large index091_phase_kickback.sq— 091 phase kickback092_hidden_shift.sq— 092 hidden shift093_qft_phase_grid.sq— 093 qft phase grid094_entangled_ladder.sq— 094 entangled ladder095_hardware_efficient_ansatz.sq— 095 hardware efficient ansatz096_maxcut_ansatz.sq— 096 maxcut ansatz097_qml_feature_map.sq— 097 qml feature map098_controlled_rotation_bank.sq— 098 controlled rotation bank099_multi_control_demo.sq— 099 multi control demo100_sparse_large_index.sq— 100 sparse large index101_stabilizer_ghz_1000.sq— 101 stabilizer ghz 1000102_mps_low_entanglement_chain.sq— 102 mps low entanglement chain103_density_depolarizing_noise.sq— 103 density depolarizing noise104_density_amplitude_damping.sq— 104 density amplitude damping105_hybrid_backend_selection.sq— 105 hybrid backend selection106_optimizer_cancel_rotations.sq— 106 optimizer cancel rotations107_gpu_backend_small.sq— 107 gpu backend small108_qiskit_interop_reference.sq— 108 qiskit interop reference109_large_sparse_150_qubits.sq— 109 large sparse 150 qubits110_mps_qft_lite.sq— 110 mps qft lite111_150q_sensor_fusion_111.sq— 111 150q sensor fusion 111112_150q_satellite_telemetry_112.sq— 112 150q satellite telemetry 112113_150q_network_intrusion_113.sq— 113 150q network intrusion 113114_150q_portfolio_risk_114.sq— 114 150q portfolio risk 114115_150q_drug_screening_115.sq— 115 150q drug screening 115116_150q_battery_material_116.sq— 116 150q battery material 116117_150q_smart_grid_117.sq— 117 150q smart grid 117118_150q_robotics_path_118.sq— 118 150q robotics path 118119_150q_climate_event_119.sq— 119 150q climate event 119120_150q_factory_quality_120.sq— 120 150q factory quality 120121_150q_traffic_routing_121.sq— 121 150q traffic routing 121122_150q_fraud_detection_122.sq— 122 150q fraud detection 122123_150q_genomics_variant_123.sq— 123 150q genomics variant 123124_150q_seismic_monitor_124.sq— 124 150q seismic monitor 124125_150q_iot_edge_125.sq— 125 150q iot edge 125126_150q_cyber_key_health_126.sq— 126 150q cyber key health 126127_150q_medical_triage_127.sq— 127 150q medical triage 127128_150q_supply_chain_128.sq— 128 150q supply chain 128129_150q_water_network_129.sq— 129 150q water network 129130_150q_energy_market_130.sq— 130 150q energy market 130131_150q_sensor_fusion_131.sq— 131 150q sensor fusion 131132_150q_satellite_telemetry_132.sq— 132 150q satellite telemetry 132133_150q_network_intrusion_133.sq— 133 150q network intrusion 133134_150q_portfolio_risk_134.sq— 134 150q portfolio risk 134135_150q_drug_screening_135.sq— 135 150q drug screening 135136_150q_battery_material_136.sq— 136 150q battery material 136137_150q_smart_grid_137.sq— 137 150q smart grid 137138_150q_robotics_path_138.sq— 138 150q robotics path 138139_150q_climate_event_139.sq— 139 150q climate event 139140_150q_factory_quality_140.sq— 140 150q factory quality 140141_stabilizer_clifford_comm_141.sq— 141 stabilizer clifford comm 141142_stabilizer_graph_state_142.sq— 142 stabilizer graph state 142143_stabilizer_cluster_state_143.sq— 143 stabilizer cluster state 143144_stabilizer_parity_monitor_144.sq— 144 stabilizer parity monitor 144145_stabilizer_surface_code_syndrome_145.sq— 145 stabilizer surface code syndrome 145146_stabilizer_clifford_comm_146.sq— 146 stabilizer clifford comm 146147_stabilizer_graph_state_147.sq— 147 stabilizer graph state 147148_stabilizer_cluster_state_148.sq— 148 stabilizer cluster state 148149_stabilizer_parity_monitor_149.sq— 149 stabilizer parity monitor 149150_stabilizer_surface_code_syndrome_150.sq— 150 stabilizer surface code syndrome 150151_stabilizer_clifford_comm_151.sq— 151 stabilizer clifford comm 151152_stabilizer_graph_state_152.sq— 152 stabilizer graph state 152153_stabilizer_cluster_state_153.sq— 153 stabilizer cluster state 153154_stabilizer_parity_monitor_154.sq— 154 stabilizer parity monitor 154155_stabilizer_surface_code_syndrome_155.sq— 155 stabilizer surface code syndrome 155156_stabilizer_clifford_comm_156.sq— 156 stabilizer clifford comm 156157_stabilizer_graph_state_157.sq— 157 stabilizer graph state 157158_stabilizer_cluster_state_158.sq— 158 stabilizer cluster state 158159_stabilizer_parity_monitor_159.sq— 159 stabilizer parity monitor 159160_stabilizer_surface_code_syndrome_160.sq— 160 stabilizer surface code syndrome 160161_stabilizer_clifford_comm_161.sq— 161 stabilizer clifford comm 161162_stabilizer_graph_state_162.sq— 162 stabilizer graph state 162163_stabilizer_cluster_state_163.sq— 163 stabilizer cluster state 163164_stabilizer_parity_monitor_164.sq— 164 stabilizer parity monitor 164165_stabilizer_surface_code_syndrome_165.sq— 165 stabilizer surface code syndrome 165166_mps_adiabatic_line_166.sq— 166 mps adiabatic line 166167_mps_qft_lite_167.sq— 167 mps qft lite 167168_mps_bond_dimension_probe_168.sq— 168 mps bond dimension probe 168169_mps_matrix_product_feature_map_169.sq— 169 mps matrix product feature map 169170_mps_spin_chain_170.sq— 170 mps spin chain 170171_mps_adiabatic_line_171.sq— 171 mps adiabatic line 171172_mps_qft_lite_172.sq— 172 mps qft lite 172173_mps_bond_dimension_probe_173.sq— 173 mps bond dimension probe 173174_mps_matrix_product_feature_map_174.sq— 174 mps matrix product feature map 174175_mps_spin_chain_175.sq— 175 mps spin chain 175176_mps_adiabatic_line_176.sq— 176 mps adiabatic line 176177_mps_qft_lite_177.sq— 177 mps qft lite 177178_mps_bond_dimension_probe_178.sq— 178 mps bond dimension probe 178179_mps_matrix_product_feature_map_179.sq— 179 mps matrix product feature map 179180_mps_spin_chain_180.sq— 180 mps spin chain 180181_mps_adiabatic_line_181.sq— 181 mps adiabatic line 181182_mps_qft_lite_182.sq— 182 mps qft lite 182183_mps_bond_dimension_probe_183.sq— 183 mps bond dimension probe 183184_mps_matrix_product_feature_map_184.sq— 184 mps matrix product feature map 184185_mps_spin_chain_185.sq— 185 mps spin chain 185186_mps_adiabatic_line_186.sq— 186 mps adiabatic line 186187_mps_qft_lite_187.sq— 187 mps qft lite 187188_mps_bond_dimension_probe_188.sq— 188 mps bond dimension probe 188189_mps_matrix_product_feature_map_189.sq— 189 mps matrix product feature map 189190_mps_spin_chain_190.sq— 190 mps spin chain 190191_noise_readout_channel_191.sq— 191 noise readout channel 191192_noise_amplitude_decay_192.sq— 192 noise amplitude decay 192193_noise_phase_noise_193.sq— 193 noise phase noise 193194_noise_depolarizing_benchmark_194.sq— 194 noise depolarizing benchmark 194195_noise_noisy_bell_195.sq— 195 noise noisy bell 195196_noise_readout_channel_196.sq— 196 noise readout channel 196197_noise_amplitude_decay_197.sq— 197 noise amplitude decay 197198_noise_phase_noise_198.sq— 198 noise phase noise 198199_noise_depolarizing_benchmark_199.sq— 199 noise depolarizing benchmark 199200_noise_noisy_bell_200.sq— 200 noise noisy bell 200201_noise_readout_channel_201.sq— 201 noise readout channel 201202_noise_amplitude_decay_202.sq— 202 noise amplitude decay 202203_noise_phase_noise_203.sq— 203 noise phase noise 203204_noise_depolarizing_benchmark_204.sq— 204 noise depolarizing benchmark 204205_noise_noisy_bell_205.sq— 205 noise noisy bell 205206_noise_readout_channel_206.sq— 206 noise readout channel 206207_noise_amplitude_decay_207.sq— 207 noise amplitude decay 207208_noise_phase_noise_208.sq— 208 noise phase noise 208209_noise_depolarizing_benchmark_209.sq— 209 noise depolarizing benchmark 209210_noise_noisy_bell_210.sq— 210 noise noisy bell 210211_algorithm_grover_cyber_signature_211.sq— 211 algorithm grover cyber signature 211212_algorithm_qaoa_logistics_triangle_212.sq— 212 algorithm qaoa logistics triangle 212213_algorithm_vqe_molecule_scan_213.sq— 213 algorithm vqe molecule scan 213214_algorithm_phase_estimation_sensor_214.sq— 214 algorithm phase estimation sensor 214215_algorithm_hhl_toy_linear_system_215.sq— 215 algorithm hhl toy linear system 215216_algorithm_bernstein_vazirani_secret_216.sq— 216 algorithm bernstein vazirani secret 216217_algorithm_deutsch_jozsa_balanced_217.sq— 217 algorithm deutsch jozsa balanced 217218_algorithm_quantum_counting_inventory_218.sq— 218 algorithm quantum counting inventory 218219_algorithm_amplitude_estimation_risk_219.sq— 219 algorithm amplitude estimation risk 219220_algorithm_bb84_key_distribution_220.sq— 220 algorithm bb84 key distribution 220221_algorithm_grover_cyber_signature_221.sq— 221 algorithm grover cyber signature 221222_algorithm_qaoa_logistics_triangle_222.sq— 222 algorithm qaoa logistics triangle 222223_algorithm_vqe_molecule_scan_223.sq— 223 algorithm vqe molecule scan 223224_algorithm_phase_estimation_sensor_224.sq— 224 algorithm phase estimation sensor 224225_algorithm_hhl_toy_linear_system_225.sq— 225 algorithm hhl toy linear system 225226_algorithm_bernstein_vazirani_secret_226.sq— 226 algorithm bernstein vazirani secret 226227_algorithm_deutsch_jozsa_balanced_227.sq— 227 algorithm deutsch jozsa balanced 227228_algorithm_quantum_counting_inventory_228.sq— 228 algorithm quantum counting inventory 228229_algorithm_amplitude_estimation_risk_229.sq— 229 algorithm amplitude estimation risk 229230_algorithm_bb84_key_distribution_230.sq— 230 algorithm bb84 key distribution 230231_qml_feature_map_231.sq— 231 qml feature map 231232_qml_feature_map_232.sq— 232 qml feature map 232233_qml_feature_map_233.sq— 233 qml feature map 233234_qml_feature_map_234.sq— 234 qml feature map 234235_qml_feature_map_235.sq— 235 qml feature map 235236_qml_feature_map_236.sq— 236 qml feature map 236237_qml_feature_map_237.sq— 237 qml feature map 237238_qml_feature_map_238.sq— 238 qml feature map 238239_qml_feature_map_239.sq— 239 qml feature map 239240_qml_feature_map_240.sq— 240 qml feature map 240241_qasm3_export_climate_circuit.sq— 241 qasm3 export climate circuit242_qasm2_export_network_circuit.sq— 242 qasm2 export network circuit243_distributed_cluster_template.sq— 243 distributed cluster template244_gpu_cuda_template.sq— 244 gpu cuda template245_hybrid_backend_template.sq— 245 hybrid backend template246_formal_verification_qasm_reference.sq— 246 formal verification qasm reference247_optimizer_cancel_pairs.sq— 247 optimizer cancel pairs248_ai_training_minimal_pair.sq— 248 ai training minimal pair249_large_sparse_oracle_150q.sq— 249 large sparse oracle 150q250_large_stabilizer_4096q.sq— 250 large stabilizer 4096q
PyPI publishing steps
- Choose the final package name and confirm it is available on TestPyPI/PyPI.
- Update
pyproject.toml: version, author, maintainer, project URLs, license, keywords, and optional dependencies. - Clean old build artifacts.
rm -rf build dist *.egg-info src/*.egg-info
- Install build tools.
python -m pip install --upgrade build twine
- Build source distribution and wheel.
python -m build --sdist --wheel
- Validate metadata and README rendering.
python -m twine check dist/*
- Upload to TestPyPI first.
python -m twine upload --repository testpypi dist/*
- Test install from TestPyPI in a clean virtual environment.
python -m venv /tmp/sansqrit-test
source /tmp/sansqrit-test/bin/activate
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ sansqrit
python -c "import sansqrit; print(sansqrit.__version__)"
- Upload to production PyPI.
python -m twine upload dist/*
- Verify installation.
python -m venv /tmp/sansqrit-prod
source /tmp/sansqrit-prod/bin/activate
python -m pip install sansqrit
sansqrit --help
Use API tokens or trusted publishing. Do not hard-code PyPI passwords in scripts.
Validation commands
python -m py_compile src/sansqrit/*.py
pytest
python scripts/compile_all_examples.py
python scripts/run_all_examples.py
python -m build --sdist --wheel
python -m twine check dist/*
Some examples require optional dependencies (tensor, gpu, interop) and are written as templates when those dependencies are unavailable.
License
MIT. See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sansqrit-0.3.0.tar.gz.
File metadata
- Download URL: sansqrit-0.3.0.tar.gz
- Upload date:
- Size: 155.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9824280094b55459e932ff3e20569246cf370a52eb8ff4f280118981ea0b816f
|
|
| MD5 |
1ae17824d30b517602b0ab96164ca3f8
|
|
| BLAKE2b-256 |
08872f1833d3c0eaaefb0fe1451719eccf4a0707fff7c1ef57ad59d3f32fec5c
|
File details
Details for the file sansqrit-0.3.0-py3-none-any.whl.
File metadata
- Download URL: sansqrit-0.3.0-py3-none-any.whl
- Upload date:
- Size: 197.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2159e6032d90ffff863cfb4c9c8fb988373c02109c9a781c8234d87c8f00fcc8
|
|
| MD5 |
1ae06a9cda0b8ebae0cb54c4fdb47012
|
|
| BLAKE2b-256 |
16edbd80052d0e2f066930f57d2658fc8c1f9ead012c879ecfd49eaa3055295e
|