From 44dac82840fb85f085a325ff2caad83a2549265f Mon Sep 17 00:00:00 2001 From: David Plankensteiner Date: Tue, 30 Jun 2026 15:58:30 +0200 Subject: [PATCH 1/3] Add cargo-machete to CI and remove unused dependencies --- .github/workflows/ci.yml | 15 +++++++++++++++ Cargo.lock | 4 ---- Cargo.toml | 2 -- crates/ppvm-python-native/Cargo.toml | 1 - crates/ppvm-tableau-sum/Cargo.toml | 1 - 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 631edd75b..69eea5e8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,21 @@ jobs: SKIP: no-commit-to-branch run: mise exec -- prek run --all-files + # Detect unused dependencies across the whole workspace. cargo-machete is a + # purely syntactic check (it parses each crate's Cargo.toml and source, no + # compilation), so it needs neither a Rust toolchain nor the pre-commit gate + # and runs in parallel for fast feedback. Run from the repo root, it recurses + # into every workspace member, so all crates are covered. False positives + # (e.g. a dep used only behind cfg) can be silenced per-crate with + # `[package.metadata.cargo-machete] ignored = [...]`. + cargo-machete: + name: Unused dependencies (cargo-machete) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: bnjbvr/cargo-machete@v0.9.2 + rust-tests: name: Rust tests needs: pre-commit diff --git a/Cargo.lock b/Cargo.lock index f0aaf37d1..ce6f7cf39 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -916,8 +916,6 @@ dependencies = [ name = "ppvm" version = "0.1.0" dependencies = [ - "fxhash", - "num", "ppvm-pauli-sum", "ppvm-sym", "ppvm-tableau", @@ -963,7 +961,6 @@ name = "ppvm-python-native" version = "0.1.0" dependencies = [ "bnum", - "num", "paste", "ppvm-pauli-sum", "ppvm-stim", @@ -1040,7 +1037,6 @@ dependencies = [ "mimalloc", "num", "ppvm-pauli-sum", - "ppvm-pauli-word", "ppvm-tableau", "ppvm-traits", "rand 0.10.1", diff --git a/Cargo.toml b/Cargo.toml index 18abb3c44..ecb991f2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,8 +4,6 @@ version = "0.1.0" edition = "2024" [dependencies] -fxhash = "0.2.1" -num = "0.4.3" ppvm-pauli-sum = { version = "0.1.0", path = "crates/ppvm-pauli-sum" } ppvm-tableau = { version = "0.1.0", path = "crates/ppvm-tableau" } ppvm-sym = { version = "0.1.0", path = "crates/ppvm-sym" } diff --git a/crates/ppvm-python-native/Cargo.toml b/crates/ppvm-python-native/Cargo.toml index 8f12521ed..7d948575b 100644 --- a/crates/ppvm-python-native/Cargo.toml +++ b/crates/ppvm-python-native/Cargo.toml @@ -13,7 +13,6 @@ test = false [dependencies] bnum = "0.13.0" -num = "0.4.3" paste = "1.0.15" ppvm-pauli-sum = { version = "0.1.0", path = "../ppvm-pauli-sum" } ppvm-stim = { version = "0.1.0", path = "../ppvm-stim", features = ["rayon"] } diff --git a/crates/ppvm-tableau-sum/Cargo.toml b/crates/ppvm-tableau-sum/Cargo.toml index 65355efec..47eb0bb61 100644 --- a/crates/ppvm-tableau-sum/Cargo.toml +++ b/crates/ppvm-tableau-sum/Cargo.toml @@ -8,7 +8,6 @@ bitvec = "1.0.1" fxhash = "0.2.1" num = "0.4.3" ppvm-traits = { version = "0.1.0", path = "../ppvm-traits" } -ppvm-pauli-word = { version = "0.1.0", path = "../ppvm-pauli-word" } ppvm-pauli-sum = { version = "0.1.0", path = "../ppvm-pauli-sum" } ppvm-tableau = { version = "0.1.0", path = "../ppvm-tableau" } rand = "0.10.1" From 25b9d6bb6164152bc7cbe6c26ff7cc03130acd00 Mon Sep 17 00:00:00 2001 From: David Plankensteiner Date: Tue, 30 Jun 2026 16:31:12 +0200 Subject: [PATCH 2/3] Make it a pre-commit hook instead --- .github/workflows/ci.yml | 15 --------------- docs/src/pages/develop.astro | 13 +++++++++++++ mise.toml | 2 ++ prek.toml | 15 +++++++++++++++ 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69eea5e8c..631edd75b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,21 +52,6 @@ jobs: SKIP: no-commit-to-branch run: mise exec -- prek run --all-files - # Detect unused dependencies across the whole workspace. cargo-machete is a - # purely syntactic check (it parses each crate's Cargo.toml and source, no - # compilation), so it needs neither a Rust toolchain nor the pre-commit gate - # and runs in parallel for fast feedback. Run from the repo root, it recurses - # into every workspace member, so all crates are covered. False positives - # (e.g. a dep used only behind cfg) can be silenced per-crate with - # `[package.metadata.cargo-machete] ignored = [...]`. - cargo-machete: - name: Unused dependencies (cargo-machete) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: bnjbvr/cargo-machete@v0.9.2 - rust-tests: name: Rust tests needs: pre-commit diff --git a/docs/src/pages/develop.astro b/docs/src/pages/develop.astro index e796fbfd5..6beaa457b 100644 --- a/docs/src/pages/develop.astro +++ b/docs/src/pages/develop.astro @@ -469,6 +469,18 @@ npm run build # extract everything, then `astro build` → dist/ runners only start once Linux is fully green. +

+ Unused dependencies. A cargo-machete + prek hook flags unused crate dependencies across the whole + workspace (run from the repo root, cargo-machete + recurses into every member). It is part of the hook suite, so it runs both + locally on commit and in CI via the pre-commit job — there is + no separate machete CI job. The binary is provisioned by mise + (cargo:cargo-machete in mise.toml), so the + mise-action step that sets up the other hooks installs it too. Silence a + false positive per-crate with + [package.metadata.cargo-machete] ignored = […]. +

Why cross-OS is extension-only. The compiled PyO3 module is the only artifact whose build is OS-sensitive — macOS needs @@ -616,6 +628,7 @@ chore: restore lockfile consistency