Skip to main content

Official Python SDK for the Aṇu Astra Virtual Quantum Processor and PQC API

Project description

Aṇu Astra Python SDK (v1.1.0)

The official Python SDK for the Aṇu Astra Virtual Quantum Processor and Post-Quantum Cryptography (PQC) API.

Build and evaluate path-integral quantum circuits locally, run native OpenQASM 2.0 payloads, and secure your applications against "Store Now, Decrypt Later" threats using NIST-standardized Kyber and Dilithium algorithms.

Installation

Install the package via pip:

pip install anuastra

Quick Start: Quantum Execution (Qiskit-Style)

The QuantumCircuit builder provides a declarative, strictly-typed interface mirroring industry standards like IBM Qiskit. In v1.1.0, we introduced a smart QuantumResult wrapper. You can simply print the result to see beautiful JSON, or use dot-notation (e.g., result.states) to access data directly!

from anuastra import Client, QuantumCircuit

# Initialize with your Developer Key
astra = Client(api_key='YOUR_API_KEY_HERE')

def run_quantum():
    # Scaffold a 2-qubit circuit
    circuit = QuantumCircuit(2)
    
    # Create a Bell State (Superposition + Entanglement)
    circuit.h(0)
    circuit.cx(0, 1)

    # Execute the circuit using the Aṇu Astra path-integral engine
    result = astra.execute(circuit, shots=1)
    
    # The SDK automatically formats the result beautifully!
    print(result)

    # Or access specific properties easily:
    print(f"Engine: {result.engine}")
    print(f"Feynman Paths Explored: {result.telemetry['feynman_paths_explored']}")
    print(f"Collapsed measurement (Binary): {result.states[0]}")

if __name__ == "__main__":
    run_quantum()

Supported Quantum Gates

Aṇu Astra natively supports a sprawling library of quantum operators. You can chain these directly onto your QuantumCircuit object.

Category Supported Gates & Method Shortcuts
Pauli & Basic h(q), x(q), y(q), z(q), id(q)
Phase & S/T s(q), sdg(q), t(q), tdg(q), p(q, lambda)
Rotations rx(q, theta), ry(q, theta), rz(q, theta)
Square Root sx(q), sxdg(q)
General Unitary u1(q, l), u2(q, p, l), u3(q, t, p, l) / u(...)
2-Qubit (Controlled) cnot(c, t) / cx(...), cz(c, t), cy(c, t), ch(c, t)
2-Qubit (Advanced) swap(q1, q2), iswap(q1, q2), ecr(q1, q2), dcx(q1, q2)
2-Qubit (Rotations) crx(c, t, theta), cry(...), crz(...), cp(...), cu(...)
2-Qubit (Ising/XX) rxx(q1, q2, theta), ryy(...), rzz(...), rzx(...)
3+ Qubit (Multi) ccx(q1, q2, q3) / toffoli(...), ccz(...), cswap(...) / fredkin(...), c3x(...), c4x(...) / quadx(...)

Quick Start: OpenQASM 2.0 Ingestion

For research teams migrating from legacy hardware (like IBM Quantum), Aṇu Astra natively ingests raw .qasm strings and executes them on the physics engine.

from anuastra import Client

astra = Client(api_key='YOUR_API_KEY_HERE')

qasm_payload = """OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];
h q[0];
cx q[0],q[1];
measure q[0] -> c[0];
measure q[1] -> c[1];
"""

# Execute the raw OpenQASM syntax natively
response = astra.execute_qasm(qasm_payload, shots=5)

# Output is wrapped in the QuantumResult object
print(response)

API Endpoint Defaulting

Note: As of v1.1.0, the SDK automatically points to the live production server at https://astra.cryptopix.in/api/v1 out of the box.

Post-Quantum Cryptography (PQC)

The Aṇu Astra SDK exposes NIST FIPS-203 and FIPS-204 standardized algorithms.

1. Key Encapsulation (ML-KEM / Kyber)

Used for establishing symmetric quantum-resistant tunnels over public networks (TLS/TCP).

[!IMPORTANT] Zero-Trust Architecture (v1.0.2+): keygen and decapsulate are now executed entirely locally on your device using the pure-Python fips203 distribution. Aṇu Astra never transmits or stores your private parameters.

# 1. Generate keys LOCALLY (Server A)
# No private keys leave your device
keys = astra.kyber.keygen_local(level=768)
public_key = keys['public_key']
private_key = keys['private_key']

# 2. Encapsulate via VQP (Server B)
# Server B uses Public Key to create a Shared Secret + Ciphertext
capsule = astra.kyber.encapsulate(public_key)

# 3. Decapsulate LOCALLY (Server A)
# Server A uses Private Key + Ciphertext to derive the exact same Shared Secret
resolved = astra.kyber.decapsulate_local(capsule['ciphertext'], private_key)

2. Digital Signatures (ML-DSA / Dilithium)

Used for unbreakable document signing, firmware validation, and transaction authentication.

# 1. Generate keys
keys = astra.dilithium.keygen(level=3)
public_key = keys['public_key']
private_key = keys['private_key']

# 2. Sign a payload
message = "Quantum Safe transaction payload"
signed = astra.dilithium.sign(message, private_key)

# 3. Verify the payload cryptographically
validation = astra.dilithium.verify(signed['signature'], message, public_key)
print(validation['is_valid']) # Returns True

License

MIT

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

anuastra-1.1.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anuastra-1.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file anuastra-1.1.0.tar.gz.

File metadata

  • Download URL: anuastra-1.1.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for anuastra-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f5af0a5f7743566482fe6ee65aa6f4fb0c2fdfd8b53da5cf515d6b1d0c75bef8
MD5 434854542d7046838cb1004ae31d5a7f
BLAKE2b-256 8119af2ffa96e7c5836d466cfe2f42740cc85dc7d5d7db72ff3d154349e55020

See more details on using hashes here.

File details

Details for the file anuastra-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: anuastra-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for anuastra-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74aae7bf14733c7134c6cc56d72d825874f5cde7a650230a69f79b17ffa08978
MD5 985cfd639e159558c578369cbc8050a5
BLAKE2b-256 6a1526fb2942b5dc47d02a44eca04f198e4f818035da9d993edc0d4c5672b0b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page