vision-squeezer 0.6.0

LLM-native image optimization middleware & MCP server. Reduces vision model token consumption by snapping to tile boundaries.
Documentation
name: Python wheels

on:
  push:
    tags: ["v*"]
  workflow_dispatch:

# Cancel queued/running wheel jobs if a newer tag supersedes them.
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  linux:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        target: [x86_64, aarch64]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.11"
      - name: Build wheels
        uses: PyO3/maturin-action@v1
        with:
          target: ${{ matrix.target }}
          # Python 3.8 + 3.9 dropped: both are EOL and rarely used in modern
          # vision stacks. Trims the per-platform wheel count from 6 → 4.
          args: --release --out dist --manifest-path python/Cargo.toml --interpreter 3.10 3.11 3.12 3.13
          sccache: "true"
          manylinux: 2_28
      - uses: actions/upload-artifact@v4
        with:
          name: wheels-linux-${{ matrix.target }}
          path: dist
          retention-days: 14

  macos:
    runs-on: macos-latest
    # Intel macOS dropped: macos-latest is arm64 only since 2024 (Intel runs
    # would be billed at 10× and Apple has EOL'd Intel Macs). Users on Intel
    # Macs can install via Rosetta or `pip install --no-binary`.
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.11"
      - name: Build wheels
        uses: PyO3/maturin-action@v1
        with:
          target: aarch64
          args: --release --out dist --manifest-path python/Cargo.toml
          sccache: "true"
      - uses: actions/upload-artifact@v4
        with:
          name: wheels-macos-aarch64
          path: dist
          retention-days: 14

  windows:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.11"
      - name: Build wheels
        uses: PyO3/maturin-action@v1
        with:
          target: x64
          args: --release --out dist --manifest-path python/Cargo.toml
          sccache: "true"
      - uses: actions/upload-artifact@v4
        with:
          name: wheels-windows-x64
          path: dist
          retention-days: 14

  sdist:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build sdist
        uses: PyO3/maturin-action@v1
        with:
          command: sdist
          args: --out dist --manifest-path python/Cargo.toml
      - uses: actions/upload-artifact@v4
        with:
          name: wheels-sdist
          path: dist
          retention-days: 14

  # PyPI publish via Trusted Publishing (OIDC) — no API token/secret. The
  # `id-token: write` permission lets pypa/gh-action-pypi-publish mint the
  # short-lived token PyPI exchanges against the registered trusted publisher.
  # Requires (one-time, in the PyPI + GitHub UIs):
  #   - PyPI trusted publisher for project "vision-squeezer": owner eralpozcan,
  #     repo vision-squeezer, workflow python.yml, environment pypi.
  #   - GitHub environment named "pypi".
  # Runs on a v* tag or a manual dispatch. The first successful upload creates
  # the project on PyPI and flips the pending publisher to active.
  release:
    name: Publish to PyPI
    runs-on: ubuntu-latest
    if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v')
    needs: [linux, macos, windows, sdist]
    environment:
      name: pypi
      url: https://pypi.org/p/vision-squeezer
    permissions:
      id-token: write
    steps:
      - uses: actions/download-artifact@v4
        with:
          pattern: wheels-*
          merge-multiple: true
          path: dist
      - name: Publish to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          skip-existing: true