vision-squeezer 0.8.1

Fit images to a vision-LLM token budget before you send them. Library, CLI and MCP server for code, agents and pipelines.
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@v5
      - uses: actions/setup-python@v6
        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@v5
        with:
          name: wheels-linux-${{ matrix.target }}
          path: dist
          retention-days: 14

  macos:
    runs-on: macos-latest
    # Native Apple Silicon wheel.
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-python@v6
        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@v5
        with:
          name: wheels-macos-aarch64
          path: dist
          retention-days: 14

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

  windows:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-python@v6
        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@v5
        with:
          name: wheels-windows-x64
          path: dist
          retention-days: 14

  sdist:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - name: Build sdist
        uses: PyO3/maturin-action@v1
        with:
          command: sdist
          args: --out dist --manifest-path python/Cargo.toml
      - uses: actions/upload-artifact@v5
        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, macos-intel, windows, sdist]
    environment:
      name: pypi
      url: https://pypi.org/p/vision-squeezer
    permissions:
      id-token: write
    steps:
      - uses: actions/download-artifact@v5
        with:
          pattern: wheels-*
          merge-multiple: true
          path: dist
      - name: Publish to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          skip-existing: true