diff --git a/.cargo/config.toml b/.cargo/config.toml index 414c8c83e..9e701f3ba 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -3,6 +3,11 @@ [target.'cfg(target_arch = "x86_64")'] rustflags = ["-C", "target-feature=+aes,+sse2"] +# Same for aarch64 Linux, whose default target features lack AES (Apple +# targets already enable it). Needed for the linux-aarch64 release wheel. +[target.'cfg(all(target_arch = "aarch64", target_os = "linux"))'] +rustflags = ["-C", "target-feature=+aes,+neon"] + # On wasm32 (browser) `getrandom` has no default entropy source. Select its JS # backend so `rand` (e.g. `rand::make_rng()` in the tableau simulators) reads # from the Web Crypto API. Pairs with the `getrandom`/`wasm_js` feature enabled diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml new file mode 100644 index 000000000..fb14222ce --- /dev/null +++ b/.github/workflows/release-plz.yml @@ -0,0 +1,221 @@ +name: Release-plz + +# Lockstep release of the Rust crates (crates.io) and bloqade-ppvm (PyPI). +# +# On every push to main: +# - release-plz-pr opens/updates the release PR (version bump + CHANGELOG.md). +# - release-plz-release publishes any unpublished crate versions, then +# creates the `v0.x.y` tag and GitHub release (i.e. when the release PR +# is merged). If it released, the wheels are built, tested and published. +# Run manually for a build-and-test dry run of the wheels; `publish_pypi` +# (main only) also publishes the current version to PyPI. +# +# Auth: crates.io and PyPI both use OIDC trusted publishing (no tokens). The +# PyPI publisher points at this file and the `pypi` environment. + +on: + push: + branches: [main] + workflow_dispatch: + inputs: + publish_pypi: + description: "Publish the current version to PyPI (main only)" + type: boolean + default: false + +permissions: {} + +env: + CARGO_TERM_COLOR: always + +jobs: + release-plz-release: + name: Release-plz release + if: ${{ github.event_name == 'push' }} + runs-on: ubuntu-latest + # One release at a time, so quick merges can't race to publish the same version. + concurrency: + group: release-plz-release-${{ github.ref }} + cancel-in-progress: false + permissions: + contents: write # tags + GitHub release + pull-requests: read # link merged PRs in the release notes + id-token: write # crates.io trusted publishing + outputs: + releases_created: ${{ steps.release-plz.outputs.releases_created }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + - uses: dtolnay/rust-toolchain@1.98.0 + - uses: Swatinem/rust-cache@v2 + - name: Run release-plz + id: release-plz + uses: release-plz/action@v0.5.139 + with: + command: release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + release-plz-pr: + name: Release-plz PR + if: ${{ github.event_name == 'push' }} + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + concurrency: + group: release-plz-${{ github.ref }} + cancel-in-progress: false + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + - uses: dtolnay/rust-toolchain@1.98.0 + - uses: Swatinem/rust-cache@v2 + - name: Run release-plz + uses: release-plz/action@v0.5.139 + with: + command: release-pr + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # One abi3 wheel per platform (pyo3 `abi3-py310`), so no Python matrix. + build: + name: Wheel (${{ matrix.target }}) + needs: [release-plz-release] + if: >- + ${{ !cancelled() && (needs.release-plz-release.outputs.releases_created == 'true' + || github.event_name == 'workflow_dispatch') }} + permissions: + contents: read + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: ubuntu-latest + target: aarch64-unknown-linux-gnu + - os: macos-14 + target: x86_64-apple-darwin + - os: macos-14 + target: aarch64-apple-darwin + - os: windows-latest + target: x86_64-pc-windows-msvc + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + # manylinux_2_28 = glibc 2.28+ (RHEL 8 / Ubuntu 20.04+); ignored off Linux. + - name: Build wheel + uses: PyO3/maturin-action@v1 + with: + working-directory: ppvm-python + target: ${{ matrix.target }} + args: --release --out dist + manylinux: "2_28" + + - uses: actions/upload-artifact@v4 + with: + name: wheel-${{ matrix.target }} + path: ppvm-python/dist/*.whl + + sdist: + name: sdist + needs: [release-plz-release] + if: >- + ${{ !cancelled() && (needs.release-plz-release.outputs.releases_created == 'true' + || github.event_name == 'workflow_dispatch') }} + permissions: + contents: read + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + working-directory: ppvm-python + command: sdist + args: --out dist + + - uses: actions/upload-artifact@v4 + with: + name: sdist + path: ppvm-python/dist/*.tar.gz + + # Install each wheel into a clean env and run the Python test suite against + # it, so a broken wheel never reaches PyPI. The x86_64 macOS wheel is not + # tested: there is no native runner for it. + test: + name: Test (${{ matrix.target }}, py${{ matrix.python }}) + needs: [build] + if: ${{ !cancelled() && needs.build.result == 'success' }} + permissions: + contents: read + strategy: + fail-fast: false + matrix: + python: ["3.10", "3.13"] + target: + - x86_64-unknown-linux-gnu + - aarch64-unknown-linux-gnu + - aarch64-apple-darwin + - x86_64-pc-windows-msvc + include: + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + - target: aarch64-unknown-linux-gnu + os: ubuntu-24.04-arm + - target: aarch64-apple-darwin + os: macos-14 + - target: x86_64-pc-windows-msvc + os: windows-latest + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: astral-sh/setup-uv@v5 + + - uses: actions/download-artifact@v4 + with: + name: wheel-${{ matrix.target }} + path: dist + + # Run from outside ppvm-python/ so the src/ tree can't shadow the wheel. + - name: Run tests against the installed wheel + shell: bash + working-directory: ${{ runner.temp }} + run: >- + uv run --no-project --isolated --python ${{ matrix.python }} + --with "$(ls "$GITHUB_WORKSPACE"/dist/*.whl)" + --with pytest --with pytest-benchmark + pytest -p no:cacheprovider "$GITHUB_WORKSPACE/ppvm-python/test" + + publish-to-pypi: + name: Publish to PyPI + needs: [release-plz-release, sdist, test] + if: >- + ${{ !cancelled() && needs.sdist.result == 'success' && needs.test.result == 'success' + && (needs.release-plz-release.outputs.releases_created == 'true' + || (inputs.publish_pypi && github.ref == 'refs/heads/main')) }} + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/bloqade-ppvm + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true + + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/Cargo.toml b/Cargo.toml index 92cc72838..ce5e5b334 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,9 @@ [package] name = "ppvm" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +# Examples-only package; not published. +publish = false [dependencies] ppvm-pauli-sum = { version = "0.1.0", path = "crates/ppvm-pauli-sum" } @@ -29,6 +31,14 @@ members = [ "skills/ppvm-usage/examples/rust", ] +# Single version for every crate and the `bloqade-ppvm` Python package +# (via ppvm-python-native); bumped by release-plz. +[workspace.package] +version = "0.1.0" +edition = "2024" +license = "Apache-2.0" +repository = "https://github.com/QuEraComputing/ppvm" + # Keep function names and line numbers in release builds so profilers # (cargo-flamegraph, samply, Instruments) produce readable output. Adds # negligible binary bloat compared to full debug info. diff --git a/crates/ppvm-cli/Cargo.toml b/crates/ppvm-cli/Cargo.toml index 38290e612..ef5091d6b 100644 --- a/crates/ppvm-cli/Cargo.toml +++ b/crates/ppvm-cli/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "ppvm-cli" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description = "Command-line tool and TUI for parsing, running and stepping through ppvm `.sst` programs." [dependencies] clap = { version = "4.6.1", features = ["derive"] } diff --git a/crates/ppvm-cli/LICENSE b/crates/ppvm-cli/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/crates/ppvm-cli/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/ppvm-cli/NOTICE b/crates/ppvm-cli/NOTICE new file mode 120000 index 000000000..fb376cfaa --- /dev/null +++ b/crates/ppvm-cli/NOTICE @@ -0,0 +1 @@ +../../NOTICE \ No newline at end of file diff --git a/crates/ppvm-pauli-sum/Cargo.toml b/crates/ppvm-pauli-sum/Cargo.toml index 9cd8e1a9f..ab620e808 100644 --- a/crates/ppvm-pauli-sum/Cargo.toml +++ b/crates/ppvm-pauli-sum/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "ppvm-pauli-sum" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description = "Pauli-propagation engine for ppvm: `PauliSum`, truncation strategies and ready-made configs." [dependencies] ppvm-traits = { version = "0.1.0", path = "../ppvm-traits" } diff --git a/crates/ppvm-pauli-sum/LICENSE b/crates/ppvm-pauli-sum/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/crates/ppvm-pauli-sum/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/ppvm-pauli-sum/NOTICE b/crates/ppvm-pauli-sum/NOTICE new file mode 120000 index 000000000..fb376cfaa --- /dev/null +++ b/crates/ppvm-pauli-sum/NOTICE @@ -0,0 +1 @@ +../../NOTICE \ No newline at end of file diff --git a/crates/ppvm-pauli-word/Cargo.toml b/crates/ppvm-pauli-word/Cargo.toml index c789944c5..3a0cb89c9 100644 --- a/crates/ppvm-pauli-word/Cargo.toml +++ b/crates/ppvm-pauli-word/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "ppvm-pauli-word" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description = "Packed Pauli-string types (plain, phased, lossy and pattern) for the ppvm simulators." [dependencies] ppvm-traits = { version = "0.1.0", path = "../ppvm-traits" } diff --git a/crates/ppvm-pauli-word/LICENSE b/crates/ppvm-pauli-word/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/crates/ppvm-pauli-word/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/ppvm-pauli-word/NOTICE b/crates/ppvm-pauli-word/NOTICE new file mode 120000 index 000000000..fb376cfaa --- /dev/null +++ b/crates/ppvm-pauli-word/NOTICE @@ -0,0 +1 @@ +../../NOTICE \ No newline at end of file diff --git a/crates/ppvm-python-native/Cargo.toml b/crates/ppvm-python-native/Cargo.toml index aaf14b584..9057573e6 100644 --- a/crates/ppvm-python-native/Cargo.toml +++ b/crates/ppvm-python-native/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "ppvm-python-native" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] diff --git a/crates/ppvm-stim/Cargo.toml b/crates/ppvm-stim/Cargo.toml index 6f0329988..c6f53d4e6 100644 --- a/crates/ppvm-stim/Cargo.toml +++ b/crates/ppvm-stim/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "ppvm-stim" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description = "Parse and run Stim circuits on the ppvm generalized stabilizer tableau." [features] default = [] diff --git a/crates/ppvm-stim/LICENSE b/crates/ppvm-stim/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/crates/ppvm-stim/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/ppvm-stim/NOTICE b/crates/ppvm-stim/NOTICE new file mode 120000 index 000000000..fb376cfaa --- /dev/null +++ b/crates/ppvm-stim/NOTICE @@ -0,0 +1 @@ +../../NOTICE \ No newline at end of file diff --git a/crates/ppvm-sym/Cargo.toml b/crates/ppvm-sym/Cargo.toml index cec8b2a1b..795149bcf 100644 --- a/crates/ppvm-sym/Cargo.toml +++ b/crates/ppvm-sym/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "ppvm-sym" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description = "Symbolic, parametric Pauli propagation for ppvm." [dependencies] anyhow = "1.0.100" diff --git a/crates/ppvm-sym/LICENSE b/crates/ppvm-sym/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/crates/ppvm-sym/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/ppvm-sym/NOTICE b/crates/ppvm-sym/NOTICE new file mode 120000 index 000000000..fb376cfaa --- /dev/null +++ b/crates/ppvm-sym/NOTICE @@ -0,0 +1 @@ +../../NOTICE \ No newline at end of file diff --git a/crates/ppvm-tableau-sum/Cargo.toml b/crates/ppvm-tableau-sum/Cargo.toml index 618bd6db0..fbd601e4c 100644 --- a/crates/ppvm-tableau-sum/Cargo.toml +++ b/crates/ppvm-tableau-sum/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "ppvm-tableau-sum" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description = "Sums of generalized stabilizer tableaux with sampling, measurement and noise, for ppvm." [dependencies] bitvec = "1.0.1" diff --git a/crates/ppvm-tableau-sum/LICENSE b/crates/ppvm-tableau-sum/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/crates/ppvm-tableau-sum/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/ppvm-tableau-sum/NOTICE b/crates/ppvm-tableau-sum/NOTICE new file mode 120000 index 000000000..fb376cfaa --- /dev/null +++ b/crates/ppvm-tableau-sum/NOTICE @@ -0,0 +1 @@ +../../NOTICE \ No newline at end of file diff --git a/crates/ppvm-tableau/Cargo.toml b/crates/ppvm-tableau/Cargo.toml index 6b5c4dc07..e53f4d461 100644 --- a/crates/ppvm-tableau/Cargo.toml +++ b/crates/ppvm-tableau/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "ppvm-tableau" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description = "Generalized stabilizer-tableau simulator for ppvm." [features] default = [] diff --git a/crates/ppvm-tableau/LICENSE b/crates/ppvm-tableau/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/crates/ppvm-tableau/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/ppvm-tableau/NOTICE b/crates/ppvm-tableau/NOTICE new file mode 120000 index 000000000..fb376cfaa --- /dev/null +++ b/crates/ppvm-tableau/NOTICE @@ -0,0 +1 @@ +../../NOTICE \ No newline at end of file diff --git a/crates/ppvm-traits-2/Cargo.toml b/crates/ppvm-traits-2/Cargo.toml index 4a772596e..0110c292a 100644 --- a/crates/ppvm-traits-2/Cargo.toml +++ b/crates/ppvm-traits-2/Cargo.toml @@ -3,8 +3,11 @@ [package] name = "ppvm-traits-2" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +publish = false [dependencies] num = "0.4" diff --git a/crates/ppvm-traits/Cargo.toml b/crates/ppvm-traits/Cargo.toml index 10a1e54a5..2a4c8a2bf 100644 --- a/crates/ppvm-traits/Cargo.toml +++ b/crates/ppvm-traits/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "ppvm-traits" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description = "Core traits, the `Config` bundle and the single-qubit Pauli alphabet shared by the ppvm crates." [dependencies] bitvec = "1.0.1" diff --git a/crates/ppvm-traits/LICENSE b/crates/ppvm-traits/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/crates/ppvm-traits/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/ppvm-traits/NOTICE b/crates/ppvm-traits/NOTICE new file mode 120000 index 000000000..fb376cfaa --- /dev/null +++ b/crates/ppvm-traits/NOTICE @@ -0,0 +1 @@ +../../NOTICE \ No newline at end of file diff --git a/crates/ppvm-tui/Cargo.toml b/crates/ppvm-tui/Cargo.toml index 22a4ffc06..2ba54d303 100644 --- a/crates/ppvm-tui/Cargo.toml +++ b/crates/ppvm-tui/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "ppvm-tui" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description = "Composable ratatui components and app state for the ppvm terminal UI." [dependencies] eyre = "0.6.12" diff --git a/crates/ppvm-tui/LICENSE b/crates/ppvm-tui/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/crates/ppvm-tui/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/ppvm-tui/NOTICE b/crates/ppvm-tui/NOTICE new file mode 120000 index 000000000..fb376cfaa --- /dev/null +++ b/crates/ppvm-tui/NOTICE @@ -0,0 +1 @@ +../../NOTICE \ No newline at end of file diff --git a/crates/ppvm-vihaco/Cargo.toml b/crates/ppvm-vihaco/Cargo.toml index 40602edcf..61b4e1edd 100644 --- a/crates/ppvm-vihaco/Cargo.toml +++ b/crates/ppvm-vihaco/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "ppvm-vihaco" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description = "Run vihaco circuit programs on the ppvm simulators." [features] # Parallelism via rayon: shot-level (`run_shots`) and tableau-internal. Off by diff --git a/crates/ppvm-vihaco/LICENSE b/crates/ppvm-vihaco/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/crates/ppvm-vihaco/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/ppvm-vihaco/NOTICE b/crates/ppvm-vihaco/NOTICE new file mode 120000 index 000000000..fb376cfaa --- /dev/null +++ b/crates/ppvm-vihaco/NOTICE @@ -0,0 +1 @@ +../../NOTICE \ No newline at end of file diff --git a/crates/stim-parser/Cargo.toml b/crates/stim-parser/Cargo.toml index 3941e8014..221d1d1b2 100644 --- a/crates/stim-parser/Cargo.toml +++ b/crates/stim-parser/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "stim-parser" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description = "Parser for the Stim circuit format, including an extended dialect." [dependencies] ariadne = "0.5" diff --git a/crates/stim-parser/LICENSE b/crates/stim-parser/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/crates/stim-parser/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/stim-parser/NOTICE b/crates/stim-parser/NOTICE new file mode 120000 index 000000000..fb376cfaa --- /dev/null +++ b/crates/stim-parser/NOTICE @@ -0,0 +1 @@ +../../NOTICE \ No newline at end of file diff --git a/crates/vihaco-circuit-isa/Cargo.toml b/crates/vihaco-circuit-isa/Cargo.toml index b64fc9109..69bae76df 100644 --- a/crates/vihaco-circuit-isa/Cargo.toml +++ b/crates/vihaco-circuit-isa/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "vihaco-circuit-isa" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description = "Quantum-circuit instruction set for the vihaco virtual machine, used by ppvm." [dependencies] chumsky = "0.10" diff --git a/crates/vihaco-circuit-isa/LICENSE b/crates/vihaco-circuit-isa/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/crates/vihaco-circuit-isa/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/vihaco-circuit-isa/NOTICE b/crates/vihaco-circuit-isa/NOTICE new file mode 120000 index 000000000..fb376cfaa --- /dev/null +++ b/crates/vihaco-circuit-isa/NOTICE @@ -0,0 +1 @@ +../../NOTICE \ No newline at end of file diff --git a/docs/src/pages/develop.astro b/docs/src/pages/develop.astro index 91dbbf5bf..27afe5008 100644 --- a/docs/src/pages/develop.astro +++ b/docs/src/pages/develop.astro @@ -73,6 +73,7 @@ const toc = [ { label: "§ 5 Python bindings", href: "#python-bindings" }, { label: "§ 6 Extending ppvm", href: "#extending" }, { label: "§ 7 Where to look for X", href: "#where-to-look" }, + { label: "§ 8 Releasing", href: "#releasing" }, ]; --- @@ -222,9 +223,9 @@ uv run --project ppvm-python --group dev pytest ppvm-python/test/test_basics.py uv run --project ppvm-python --group dev pytest ppvm-python/test/ -k test_ghz

- The compiled ppvm._core is part of the ppvm + The compiled ppvm._core is part of the bloqade-ppvm wheel, so after changing Rust force a rebuild with uv sync - --project ppvm-python --reinstall-package ppvm (or maturin + --project ppvm-python --reinstall-package bloqade-ppvm (or maturin develop -m crates/ppvm-python-native/Cargo.toml). The Python project is configured to use uv-managed Python installations, so a fresh uv sync avoids linking PyO3 builds against a system Python. @@ -502,7 +503,10 @@ npm run build # extract everything, then `astro build` → dist/ (cfg(target_arch = "x86_64")), not as a workflow-wide RUSTFLAGS — those x86 features are invalid on the aarch64 macos-latest runner and would fail to compile there. Linux - and Windows (x86_64) still pick them up from the config. + and Windows (x86_64) still pick them up from the config. aarch64 Linux + gets +aes,+neon the same way (its default target features + lack AES; Apple targets already enable it), which the linux-aarch64 + release wheel needs.

§ 3Architecture

@@ -754,6 +758,111 @@ chore: restore lockfile consistency
ppvm-python/test/
+

§ 8Releasing

+ +

+ Releases are automated with release-plz + and driven by the Conventional Commit messages on main + (§ 4.1). All published crates and the + bloqade-ppvm Python package share one version + ([workspace.package] in the root Cargo.toml; + maturin reads it through ppvm-python-native) and release + together under a single v0.x.y tag, one root + CHANGELOG.md and one GitHub release. Configuration lives in + release-plz.toml; the workflow is + .github/workflows/release-plz.yml. +

+ +

8.1 The normal flow

+
    +
  1. Merge PRs to main with conventional-commit titles (PRs are squash-merged, so the title is the commit message).
  2. +
  3. The release-plz-pr job keeps a release PR open that bumps the shared version and updates CHANGELOG.md. Edit it before merging if the version or notes look wrong.
  4. +
  5. + Merging it triggers release-plz-release: it publishes + the crates to crates.io in dependency order, then creates the tag and + GitHub release. Because it released something, the same run builds + abi3 wheels (linux x86_64/aarch64, macOS x86_64/arm64, windows + x86_64) and an sdist, runs the Python test suite against each + installed wheel, and publishes to PyPI. +
  6. +
+

+ The release PR is opened with the default GITHUB_TOKEN, so + CI does not run on it. It only changes versions and the changelog. +

+ +

8.2 Versions and breaking changes

+

+ Pre-1.0, feat:/fix: bump the patch version and + a breaking change (feat!:, or a BREAKING CHANGE: + footer) bumps the minor version. semver_check runs + cargo-semver-checks and reports Rust API breaks in the + release PR. It cannot see the Python API, so mark Python-facing breaking + changes with ! yourself and review the release PR with + that in mind. +

+

+ Python-only changes don't open a release PR. + release-plz only tracks the published crates, so commits confined to + ppvm-python/ or ppvm-python-native are + invisible to it. To release them, open a PR that bumps + version in [workspace.package], updates the + internal version = "…" requirements on path + dependencies to match (for a minor bump they would otherwise reject the + new crates), runs cargo update --workspace to refresh + Cargo.lock, and adds the notes to CHANGELOG.md + by hand. Once it is merged, + release-plz-release sees an unpublished version and runs + the full release as above. +

+ +

8.3 Dry runs and recovery

+

+ Running the Release-plz workflow manually (Actions → Run + workflow) builds and tests the wheels without publishing anything. + Checking publish_pypi on main also publishes + the current version to PyPI — use this if the Python half of a + release failed after the crates were already published. To preview + the next version bump and changelog locally, run + mise exec -- release-plz update; it rewrites files in + place, so inspect with git diff and then discard. +

+

+ Published versions can't be deleted or replaced, only yanked + (cargo yank --version X.Y.Z <crate>, or "yank" in + the PyPI project settings). Fix a bad release with a new patch release. +

+ +

8.4 Auth

+

+ crates.io and PyPI both use OIDC trusted publishing, so no tokens are + stored. Each crate's trusted publisher (crates.io → crate + settings → Trusted Publishing) and the PyPI publisher point at + owner QuEraComputing, repo ppvm, workflow + release-plz.yml; PyPI additionally uses the + pypi environment. +

+ +

8.5 Adding a published crate

+
    +
  1. Inherit version, edition, license and repository from the workspace, add a description, and symlink LICENSE and NOTICE into the crate directory (ln -s ../../LICENSE). Internal-only crates get publish = false instead.
  2. +
  3. In release-plz.toml, give it a [[package]] entry with version_group = "workspace" and add it to ppvm-cli's changelog_include. Neither omission fails loudly: the crate would version on its own, or its commits would be missing from the release notes.
  4. +
  5. Trusted publishing only works for crates that already exist, so a crate owner publishes the first version by hand (cargo publish -p <crate>) and then configures its trusted publisher.
  6. +
+ +

8.6 First release (one-time)

+

+ Until the crates exist on crates.io, release-plz-release + fails on every push to main. Bootstrap 0.1.0 by hand: +

+
    +
  1. From an up-to-date main, a crates.io account that will own the crates runs cargo login and cargo publish --workspace, then adds a GitHub team as co-owner of each crate (cargo owner --add github:QuEraComputing:<team> <crate>).
  2. +
  3. Configure the trusted publisher of each of the 12 crates (§ 8.4).
  4. +
  5. Tag the published commit so the next changelog starts from it: git tag -a v0.1.0 -m v0.1.0 && git push origin v0.1.0, and optionally gh release create v0.1.0 --generate-notes.
  6. +
  7. Run the workflow manually on main with publish_pypi checked to publish bloqade-ppvm 0.1.0.
  8. +
  9. Close the stale "release v0.1.0" PR if release-plz opened one before the crates were published.
  10. +
+

Found something out of date? Send a PR — this guide is the canonical diff --git a/mise.toml b/mise.toml index 16df94724..cb7a32d3d 100644 --- a/mise.toml +++ b/mise.toml @@ -6,3 +6,5 @@ prek = "0.4.14" "github:korandoru/hawkeye" = "6.5.1" # Unused-dependency checker "cargo:cargo-machete" = "0.9.2" +# Local release preview (`release-plz update`); same version the CI action uses +release-plz = "0.3.169" diff --git a/ppvm-python/AUTHORS b/ppvm-python/AUTHORS new file mode 100644 index 000000000..04aa57314 --- /dev/null +++ b/ppvm-python/AUTHORS @@ -0,0 +1,14 @@ +# This is the list of PPVM authors for copyright purposes. +# +# This does not necessarily list everyone who has contributed code, since +# in some cases their employer may be the copyright holder. To see the +# full list of contributors, see the revision history in source control. +# +# Names should be added to this file as either: +# Name +# or +# Organization +# +# Please keep the list sorted. + +QuEra Computing Inc. diff --git a/ppvm-python/LICENSE b/ppvm-python/LICENSE new file mode 100644 index 000000000..806a6e9a6 --- /dev/null +++ b/ppvm-python/LICENSE @@ -0,0 +1,204 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for describing the origin of the Work and + reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2026 The PPVM Authors. + + For a list of copyright holders, see the AUTHORS file at the root of + this repository. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/ppvm-python/NOTICE b/ppvm-python/NOTICE new file mode 100644 index 000000000..a71e1c3e4 --- /dev/null +++ b/ppvm-python/NOTICE @@ -0,0 +1,6 @@ +PPVM - Pauli Propagation and Virtual Machine +Copyright 2026 The PPVM Authors. + +This product was initially developed at QuEra Computing Inc. +(https://www.quera.com/). See the AUTHORS file for the full list of +copyright holders. diff --git a/ppvm-python/pyproject.toml b/ppvm-python/pyproject.toml index 094a98fca..8ba65ccc8 100644 --- a/ppvm-python/pyproject.toml +++ b/ppvm-python/pyproject.toml @@ -1,18 +1,34 @@ [project] -name = "ppvm" -version = "0.1.0" -description = "Add your description here" +name = "bloqade-ppvm" +# Taken from crates/ppvm-python-native/Cargo.toml by maturin. +dynamic = ["version"] +description = "Fast Pauli propagation and stabilizer-tableau quantum circuit simulator, with a Rust core." readme = "README.md" +license = "Apache-2.0" +# Copies of the repo-root files; packaging can't reference paths outside this dir. +license-files = ["LICENSE", "NOTICE", "AUTHORS"] authors = [ { name = "David Plankensteiner", email = "dplankensteiner@quera.com" } ] requires-python = ">=3.10" +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Science/Research", + "Programming Language :: Python :: 3", + "Programming Language :: Rust", + "Topic :: Scientific/Engineering :: Physics", +] dependencies = [ "bloqade-circuit>=0.14.1", "kirin-toolchain~=0.22.2", "numpy>=2.2.6", ] +[project.urls] +Homepage = "https://queracomputing.github.io/ppvm/" +Repository = "https://github.com/QuEraComputing/ppvm" +Issues = "https://github.com/QuEraComputing/ppvm/issues" + [build-system] requires = ["maturin>=1.10,<2.0"] build-backend = "maturin" diff --git a/ppvm-python/uv.lock b/ppvm-python/uv.lock index a94a638df..7677981cd 100644 --- a/ppvm-python/uv.lock +++ b/ppvm-python/uv.lock @@ -85,6 +85,34 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/1e/d3/a7f60dacebc1bb03293546849569764698be197fad6b785f08c6276f96f0/bloqade_decoders-0.5.1-py3-none-any.whl", hash = "sha256:ac58437519160548fd7b8ea8895be3f7d81d1d2097d60c0f3fd5d5442d499bf3", size = 17015, upload-time = "2026-03-04T15:57:30.912Z" }, ] +[[package]] +name = "bloqade-ppvm" +source = { editable = "." } +dependencies = [ + { name = "bloqade-circuit" }, + { name = "kirin-toolchain" }, + { name = "numpy" }, +] + +[package.dev-dependencies] +dev = [ + { name = "pytest" }, + { name = "pytest-benchmark" }, +] + +[package.metadata] +requires-dist = [ + { name = "bloqade-circuit", specifier = ">=0.14.1" }, + { name = "kirin-toolchain", specifier = "~=0.22.2" }, + { name = "numpy", specifier = ">=2.2.6" }, +] + +[package.metadata.requires-dev] +dev = [ + { name = "pytest", specifier = ">=9.0.2" }, + { name = "pytest-benchmark", specifier = ">=5.2.3" }, +] + [[package]] name = "colorama" version = "0.4.6" @@ -899,35 +927,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" }, ] -[[package]] -name = "ppvm" -version = "0.1.0" -source = { editable = "." } -dependencies = [ - { name = "bloqade-circuit" }, - { name = "kirin-toolchain" }, - { name = "numpy" }, -] - -[package.dev-dependencies] -dev = [ - { name = "pytest" }, - { name = "pytest-benchmark" }, -] - -[package.metadata] -requires-dist = [ - { name = "bloqade-circuit", specifier = ">=0.14.1" }, - { name = "kirin-toolchain", specifier = "~=0.22.2" }, - { name = "numpy", specifier = ">=2.2.6" }, -] - -[package.metadata.requires-dev] -dev = [ - { name = "pytest", specifier = ">=9.0.2" }, - { name = "pytest-benchmark", specifier = ">=5.2.3" }, -] - [[package]] name = "py-cpuinfo" version = "9.0.0" diff --git a/release-plz.toml b/release-plz.toml new file mode 100644 index 000000000..1efec2dd6 --- /dev/null +++ b/release-plz.toml @@ -0,0 +1,86 @@ +# release-plz configuration: https://release-plz.dev/docs/config +# +# All crates (and bloqade-ppvm, via ppvm-python-native) share the workspace +# version and release in lockstep: one `v0.x.y` tag, one CHANGELOG.md, one +# GitHub release. See the "Releasing" section of the Developer Guide. + +[workspace] +semver_check = true +git_tag_name = "v{{ version }}" +# Separate key; does not inherit from git_tag_name. +git_release_name = "v{{ version }}" +# Disabled here and re-enabled on the single tag owner below, so the +# packages don't all try to create the same tag. +git_tag_enable = false +git_release_enable = false +changelog_update = false + +# Tag owner. Must be a published crate in the version group, or no tag is +# ever created. Published last, as it depends on most other crates. +[[package]] +name = "ppvm-cli" +git_tag_enable = true +git_release_enable = true +changelog_update = true +changelog_path = "CHANGELOG.md" +# Without this, commits touching only another crate miss the release notes. +# A new published crate must be added here and given a [[package]] entry. +changelog_include = [ + "ppvm-traits", + "ppvm-pauli-word", + "ppvm-pauli-sum", + "ppvm-sym", + "ppvm-tableau", + "ppvm-tableau-sum", + "ppvm-stim", + "stim-parser", + "vihaco-circuit-isa", + "ppvm-vihaco", + "ppvm-tui", +] +version_group = "workspace" + +# Every published crate joins the group so they all bump together. +[[package]] +name = "ppvm-traits" +version_group = "workspace" + +[[package]] +name = "ppvm-pauli-word" +version_group = "workspace" + +[[package]] +name = "ppvm-pauli-sum" +version_group = "workspace" + +[[package]] +name = "ppvm-sym" +version_group = "workspace" + +[[package]] +name = "ppvm-tableau" +version_group = "workspace" + +[[package]] +name = "ppvm-tableau-sum" +version_group = "workspace" + +[[package]] +name = "ppvm-stim" +version_group = "workspace" + +[[package]] +name = "stim-parser" +version_group = "workspace" + +[[package]] +name = "vihaco-circuit-isa" +version_group = "workspace" + +[[package]] +name = "ppvm-vihaco" +version_group = "workspace" + +[[package]] +name = "ppvm-tui" +version_group = "workspace"