Skip to main content

Qamomile

PyPI version License

Documentation: English | 日本語

Qamomile is a source-compiled, type-safe functional quantum programming language embedded in Python. One program can be inspected, estimated symbolically, executed by the native reference runtime, or compiled for an SDK backend without rewriting the algorithm.

Python is the familiar source language; Rust owns the compiler semantics, verification, canonical QCore representation, resource analysis, target planning, and reference execution. Quantum values are linear values rather than mutable circuit handles, so ownership mistakes are rejected before a backend artifact exists.

Python source -> verified QCore -> symbolic resources
                              -> Reference execution
                              -> Qiskit / Cirq / QURI Parts / CUDA-Q / Braket / HUGR

Installation

Qamomile requires Python 3.11 or newer. The distribution includes the native compiler in one ABI3 wheel (a binary package compatible with Python 3.11 and newer):

uv add qamomile

or

pip install qamomile

Install an SDK integration only when it is needed:

pip install "qamomile[qiskit]"
pip install "qamomile[quri_parts]"
pip install "qamomile[braket]"
pip install "qamomile[cudaq-cu13]"  # Apple Silicon or CUDA 13 on Linux
pip install "qamomile[hugr]"
pip install "qamomile[quration]"
pip install "qamomile[qir]"

For repository development, install the prerequisites in Development first. uv builds Qamomile and its bundled Rust compiler as part of the locked environment:

git clone https://github.com/Jij-Inc/Qamomile.git
cd Qamomile
uv sync --frozen --group dev

Alternatively, install the source checkout with pip from the repository root. The same build prerequisites apply. This command installs Qamomile and its bundled Rust compiler together:

pip install -e .

Coding agent skill

The installed package includes a Qamomile authoring plugin, local marketplace catalogs, and a CLI. The skill path, plugin path, and marketplace path commands only print local paths; they do not install, register, or enable integrations. Coding agents must inspect the resources and obtain the user's approval before installing skills, registering marketplaces, or enabling plugins. After approval, register the marketplace and install the plugin:

codex plugin marketplace add "$(uv run qamomile marketplace path)"
codex plugin add qamomile@qamomile

For Claude Code:

claude plugin marketplace add "$(uv run qamomile marketplace path)"
claude plugin install qamomile@qamomile

uv run qamomile plugin path prints the plugin directory. Both marketplaces and direct skill installation use the same packaged skill. The agent's plugin manager owns marketplace installations; the Qamomile CLI owns only copies made with skill install. Choose one installation method per agent to avoid duplicate discovery. Read or install the skill directly with:

uv run qamomile skill show
uv run qamomile skill show references/authoring.md
uv run qamomile skill install --agent codex
uv run qamomile skill status --agent codex

Use --agent claude-code for Claude Code and --project PATH to select another existing project directory. Codex uses .agents/skills/qamomile/; Claude Code uses .claude/skills/qamomile/. Reload the agent's project/session if needed for discovery. Commands also work as python -m qamomile.

After upgrading Qamomile, use skill update with the same agent and project. Local edits and unmanaged copies are protected. Update and remove preserve the previous copy outside skill discovery. skill path prints the bundled skills directory; skill show references/skill-cli.md explains every command and exit status. The CLI operates on local files without a remote catalog.

Quick start

Qamomile compiles function bodies from Python source without executing them. Save the program in a source file such as bell.py:

import qamomile as qm


@qm.qkernel
def bell() -> qm.Bits[2]:
    state = qm.qubits(2)
    state = qm.h(state, target=0)
    state = qm.cx(state, control=0, target=1)
    return qm.measure(state)

The same function can be estimated and executed directly:

import qamomile as qm

from bell import bell


study = qm.resources.logical(bell)
print(study.metric(qm.resources.LOGICAL_GATES))

record = qm.run(bell, on=qm.Reference(), shots=128, seed=7)
print(record.result.counts)

There is no hidden mutable circuit. Each operation consumes an owned quantum value and returns its successor. For example, writing qm.h(state) without rebinding the result is rejected instead of silently discarding a state transition.

Hamiltonian construction can remain algorithmic while instance coefficients stay ordinary classical data:

from __future__ import annotations

import qamomile as qm


@qm.qkernel
def transverse_field(
    n: qm.Const[qm.Int],
    coefficients: qm.Const[qm.Vector[qm.Real, n]],
) -> qm.Observable:
    hamiltonian = qm.zero_observable(n)
    for index in range(n):
        hamiltonian = hamiltonian + coefficients[index] * qm.X(index)
    return hamiltonian

The for remains a structured QCore loop in the reusable recipe. Binding n and coefficients materializes one canonical Hamiltonian through the Rust observable algebra; SDK backends receive the same result without owning another expression evaluator. Observable recipes are Const in this first surface: launch-time Param coefficients are rejected before an artifact is created.

n in Vector[Real, n] is Qamomile compiler syntax for a dependent dimension, rather than a standard Python type variable. Keep the future import when this source file may be imported by Python so the interpreter does not eagerly evaluate n; qm.build("file.py") parses the annotation directly. Ruff and Zuban can check a Qamomile source module without cluttering each dependent annotation by placing these module-wide directives at the top of that module:

# ruff: noqa: F821 -- dimensions are Qamomile dependent shape binders.
# mypy: disable-error-code="valid-type"

These are module-wide checker accommodations, so reserve them for Qamomile source modules. Qamomile still validates the dimension binding and its uses in the Rust compiler.

Explicit compiler lifecycle

Interactive code can use qm.run(...). Tools that need durable boundaries can use the complete lifecycle:

source -> Module -> ProgramFamily -> Program -> Artifact -> RunRecord
import qamomile as qm


module = qm.build("bell.py")
program = qm.specialize(module["bell"])
study = qm.resources.logical(program)
artifact = qm.compile(study, to=qm.Reference())
job = qm.submit(artifact, on=qm.Reference(), shots=128, seed=7)
result = job.result()

Module, program, resource-study, and artifact boundaries use deterministic, validated representations. Submitting an existing artifact never reparses or recompiles Python source. The lower-level submit(...) path returns a Job when asynchronous control is needed; run(...) retains the completed artifact, invocation, and result together as a RunRecord.

Backend namespaces

  • qamomile: language surface, compiler lifecycle, reference runtime, observables, standard library, optimization helpers, and symbolic resources
  • qamomile.qiskit: Qiskit lowering and Aer execution
  • qamomile.quration: concrete PyQret circuits, local simulation, and Quration FTQC compilation
  • qamomile.qir: QIR 1.0 Base Profile export as LLVM text and bitcode
  • qamomile.cirq: Cirq JSON, local/noisy simulation, and Google endpoints
  • qamomile.quri_parts: QURI Parts lowering and Qulacs execution
  • qamomile.cudaq: CUDA-Q lowering and local execution
  • qamomile.braket: OpenQASM 3 lowering and Amazon Braket execution
  • qamomile.hugr: structured QCore lowering to HUGR and Selene

Backend integrations exist only under the nested qamomile.<backend> namespaces.

With qamomile[qir], export a static measurement entry to QIR for an external consumer. Using bell from the quick start:

from pathlib import Path

import qamomile as qm
from bell import bell

from qamomile.qir import QIR, load_bitcode, load_ir

artifact = qm.compile(bell, to=QIR())
Path("bell.ll").write_text(load_ir(artifact), encoding="utf-8")
Path("bell.bc").write_bytes(load_bitcode(artifact))

Specialize Const inputs before export. The initial Base Profile supports terminal measurements and records a flat bit array in logical source order. Runtime parameters, measurement-dependent control, reset, discard, gates after measurement, and computed classical outputs are rejected. The artifact retains the typed result ABI and supports qamomile.persistence.serialize/deserialize; the .bc file is the standalone module for the external QIR runtime.

The repository contains one Qamomile source implementation. Compiler semantics and execution live in Rust; Python contains the source adapter, public values, and SDK-specific integration boundaries.

Development

Run these commands from the repository root. Source checkouts require:

  • Git and uv for the locked Python environment.
  • Python 3.11 or newer; Python 3.12 matches the documentation build environment.
  • rustup, which selects Rust 1.98.0, Clippy, and rustfmt from rust-toolchain.toml.
  • A native linker/toolchain: Xcode Command Line Tools on macOS, C/C++ build tools on Linux, or the MSVC C++ build tools on Windows.

A separate Protobuf compiler is unnecessary: normal builds use checked-in wire bindings, and schema tests use the vendored compiler.

rustc --version
uv sync --frozen --group dev
uv run --no-sync python -c "import qamomile, qamomile._qamomile_native"
uv run --no-sync pytest
uv run --no-sync ruff check qamomile tests
uv run --no-sync ruff format --check qamomile tests
uv run --no-sync zuban check qamomile tests/typecheck
uv run --no-sync cargo test --workspace --locked

uv sync installs Qamomile in editable mode and builds its bundled native compiler. After changing Rust code, rebuild before testing Python:

uv sync --frozen --group dev --reinstall-package qamomile
uv run --no-sync pytest rust/qamomile-python/tests

The default pytest profile excludes docs, several optional SDKs, and slow suites. A test filename alone does not override these exclusions. For example, run QURI Parts coverage with:

uv sync --frozen --group dev --extra quri_parts
uv run --no-sync pytest -m "quri_parts and not backend_slow" tests/qamomile/test_quri_parts_backend.py

Keep the selected extras/groups when syncing again, or use uv run --no-sync in the prepared environment. The HUGR and Guppy extras require separate syncs or environments.

Repository map

Path Responsibility
qamomile/ Python source capture, immutable public facades, library composition, SDK adapters.
rust/qamomile-compiler/ Compiler semantics, verified QCore, lowering, resource analysis, reference execution.
rust/qamomile-python/ PyO3 conversion and projection boundary; no independent compiler semantics.
tests/ Python API, backend, architecture, and documentation checks.
docs/ English/Japanese documentation sources, notebooks, and build tools.

Learn the language and lifecycle in the tutorials. Package and crate documentation describe implementation boundaries alongside the code.

Writing documentation

Documentation authors also need Bash and Node.js 24 (the version selected by Read the Docs). From the repository root:

uv sync --frozen --group docs
UV_NO_SYNC=1 ./docs/build.sh build-en
UV_NO_SYNC=1 ./docs/build.sh serve-en

This first preview uses committed notebook outputs. For executable changes, edit the Jupytext .py source, then sync and execute the selected page with page-build. See the documentation quick start for kernel setup, Japanese previews, and page validation.

Contributing

Contributions, bug reports, and feedback are welcome through GitHub Issues and pull requests.

License

Qamomile is released under the Apache 2.0 License.

QCE 2026 Tutorial

The Qamomile team delivered Introduction to Qamomile: Estimating Symbolically & Executing Concretely at IEEE Quantum Week (QCE 2026) on September 14, 2026. See the official program for Part 1 and Part 2.

Citation

If you use Qamomile in research, please cite:

@INPROCEEDINGS{11249901,
  author={Huang, Wei-Hao and Matsuyama, Hiromichi and Tam, Wai-Hong and Sato, Keisuke and Yamashiro, Yu},
  booktitle={2025 IEEE International Conference on Quantum Computing and Engineering (QCE)},
  title={Qamomile: A Cross-SDK Bridge for Quantum Optimization},
  year={2025},
  volume={02},
  pages={516-517},
  doi={10.1109/QCE65121.2025.10423}
}

Metadata

Release files for qamomile 0.16.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qamomile 0.16.0
File Size Uploaded Provenance Actions
qamomile-0.16.0.tar.gz 1.5 MB Without provenance Details for qamomile-0.16.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for qamomile 0.16.0
File Interpreter ABI Platform Actions
qamomile-0.16.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for qamomile-0.16.0-cp311-abi3-win_amd64.whl
qamomile-0.16.0-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details for qamomile-0.16.0-cp311-abi3-manylinux_2_28_x86_64.whl
qamomile-0.16.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for qamomile-0.16.0-cp311-abi3-macosx_11_0_arm64.whl

Total release size: 15.2 MB

Release files / qamomile-0.16.0.tar.gz

Download URL qamomile-0.16.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
d011f7a8daae9f9c5f180aa51ff5e7572c5feaf8344cdbd012bf4d9fc052da2f
BLAKE2b-256 checksum
How to use checksums
20c48645af8dc3cba78903a5e5884c75b9fc8c1bd6570353ea368232027ef210
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / qamomile-0.16.0-cp311-abi3-win_amd64.whl

Download URL qamomile-0.16.0-cp311-abi3-win_amd64.whl
Size 4.4 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
cd2afae5418939b7e6dc02b28844cfa45532e2f473390c6788e7d5c33a3d68a0
BLAKE2b-256 checksum
How to use checksums
4551f8839d169d0ff769dfa259d5e1c1abe5ae1c69208616877cc9c61c95f115
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / qamomile-0.16.0-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL qamomile-0.16.0-cp311-abi3-manylinux_2_28_x86_64.whl
Size 4.9 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
52e7d7a825a40f040323c9f2bb95accf5142694f404cd1afef8c46fec6f72706
BLAKE2b-256 checksum
How to use checksums
03012900ec9e4bbc5e48afa2ea80b3ecd88383ead997b376924af6dda18decdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / qamomile-0.16.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL qamomile-0.16.0-cp311-abi3-macosx_11_0_arm64.whl
Size 4.5 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c9f50a48cad45a973bfbc15ca9ee9a2db60caf03dbb35a7bfb15a4fb828798df
BLAKE2b-256 checksum
How to use checksums
5a45d8bc09c9e0bfd1b963dd9fd880c0868a02bb4694c24d8a66f859f311c8cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for qamomile 0.16.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.16.0 This release

4 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page