gala-python-interop
Call Gala from Python — PyO3 bridge, Jupyter kernel, PyTorch integration, NumPy arrays
Skill by gala-pl
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/gala-pl-gala-python-interop
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: ml
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/gala-python-interop
Tools it pre-approves 10
From allowed-tools in SKILL.md: the agent may use these without asking you each time.
Bash(cargorun--bingala*)ReadWriteEditGlobGrep
What's inside
- Skill name
gala-python-interop- Description
- Call Gala from Python — PyO3 bridge, Jupyter kernel, PyTorch integration, NumPy arrays
- License
- Apache-2.0
- Allowed tools
- Bash(cargo, run, --bin, gala, *), Read, Write, Edit, Glob, Grep
- Instructions
- 338 lines in SKILL.md · view on GitHub
Before installing
- Pre-approves some shell commands
Files (1)
- SKILL.md
SKILL.md (first lines)
## Task
$ARGUMENTS
## Overview
Gala provides **Python interoperability** via PyO3. Call Gala kernels from Python for incremental adoption in ML pipelines.
## Installation
```bash
# Install Gala Python package (when available)
pip install gala-lang
# Or build from source
cd tools/gala-python
maturin develop --release
```
## Basic Usage
```python
import gala
import numpy as np
# Compile Gala code from string
kernel = gala.compile("""
fn bell() -> Qubits<2> quantum {
let a = qubit()
let b = qubit()
h(a)
cx(a, b)
(a, b)
}
""")
# Run on simulator
result = kernel.run(backend="simulator", shots=1000)
print(result) # Measured distribution
```
## PyTorch Integration
```python
import torch
import gala
# Gala variational layer as PyTorch module
class GalaVQLayer(torch.nn.Module):
def __init__(self, n_qubits: int, depth: int):
super().__init__()
self.n_qubits = n_qubits
self.depth = depth
# Gala parameters as PyTorch parameters
self.theta = torch.nn.Parameter(
torch.randn(depth, n_qubits) * 0.1
)
# Compile Gala circuit
self.circuit = gala.compile(f"""
import gala.vqa.{{angle_encode, layered_ansatz}}
fn circuit(x: Vec<Float>, θ: Params) -> Measured<Float> prob {{
let q = angle_encode(qubits<{n_qubits}>(), x)
layered_ansatz(q, θ, depth: {depth})
// Measure expectation of Z on first qubit
let m = measure(q[0])
// Convert to expectation: P(0) - P(1)
Measured<Float>::new(if m {{ -1.0 }} else {{ 1.0 }})
}}
""")
def forward(self, x: torch.Tensor) -> torch.Tensor:
# x: [batch, n_qubits]
# theta: [depth, n_qubits]
results = []
for i in range(x.shape[0]):
result = self.circuit.run(
backend="simulator",
shots=1000,
x=x[i].detach().numpy(),
theta=self.theta.detach().numpy()
)
results.append(result.expectation())
return torch.tensor(results, dtype=torch.float32)
# Use in PyTorch model
class HybridModel(torch.nn.Module):
def __init__(self):
super().__init__()
self.classical = torch.nn.Sequential(
torch.nn.Linear(784, 256),
torch.nn.ReLU(),
torch.nn.Linear(256, 4) # 4 qubits
)
self.quantum = GalaVQLayer(4, 3)
self.output = torch.nn.Linear(1, 10)
def forward(self, x):
x = self.classical(x)
x = self.quantum(x) # Quantum layer
x = self.output(x)
return x
# Train end-to-end!
model = HybridModel()
optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
for epoch in range(100):
for batch_x, batch_y in dataloader:
optimizer.zero_grad()
pred = model(batch_x)
loss = torch.nn.functional.cross_entropy(pred, batch_y)
loss.backward()
optimizer.step()
```
## NumPy ArraysFrom gala-pl/gala, Apache-2.0.
More from gala-pl/gala
- 0.584score
gala-diff
gala-pl
Work with Gala's native differentiation — parameter-shift for quantum params, reverse-mode autodiff for classical, chain-rule composition
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-hardware-backends
gala-pl
Run Gala programs on quantum hardware — backend selection, capability checking, QIR emission, vendor SDKs
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-language-basics
gala-pl
Learn Gala language fundamentals — syntax, types, effects, linear qubits, basic quantum operations
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-noise-modeling
gala-pl
Model and simulate noise in Gala — typed noise models, QuEST noise channels, error mitigation
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-performance
gala-pl
Optimize Gala program performance — gate count, circuit depth, gradient cost, compilation time
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-quantum-algorithms
gala-pl
Implement quantum algorithms in Gala — QFT, Grover, phase estimation, adders, oracles
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-vqa-programming
gala-pl
Build variational quantum algorithms in Gala — encoders, ansätze, optimizers, native grad
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-ast
gala-pl
Work with Gala's AST — add node types, implement visitors, maintain CST/AST separation
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-codegen-classical
gala-pl
Work with Gala's classical codegen — Cranelift (debug) and LLVM (release) for orchestration layer
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-driver
gala-pl
Work with Gala's compilation driver — salsa DB orchestration, incremental queries, pipeline wiring
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
debug-compiler
gala-pl
Debug a compiler error or unexpected behavior in Gala source code
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-cookbook
gala-pl
Gala recipes — common patterns, idioms, algorithms, VQA templates, error handling
SkillAFreshness: A★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 23, 2026 (5 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/gala-pl/gala
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from gala-pl
- 0.584score
gala-diff
gala-pl
Work with Gala's native differentiation — parameter-shift for quantum params, reverse-mode autodiff for classical, chain-rule composition
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-language-basics
gala-pl
Learn Gala language fundamentals — syntax, types, effects, linear qubits, basic quantum operations
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-noise-modeling
gala-pl
Model and simulate noise in Gala — typed noise models, QuEST noise channels, error mitigation
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-performance
gala-pl
Optimize Gala program performance — gate count, circuit depth, gradient cost, compilation time
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-quantum-algorithms
gala-pl
Implement quantum algorithms in Gala — QFT, Grover, phase estimation, adders, oracles
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-hardware-backends
gala-pl
Run Gala programs on quantum hardware — backend selection, capability checking, QIR emission, vendor SDKs
SkillAFreshness: A★ 1Claude Code +9
Cite this page
gala-python-interop skill. Agent Mart. https://agentmart.dev/skills/gala-pl-gala-python-interop (last updated 2026-10-24)