gridoxide 0.0.2

AC power flow and state estimation solver with a sparse Newton-Raphson core
Documentation
name: Python

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  python:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Install Rust (stable)
        uses: dtolnay/rust-toolchain@stable

      - name: Cache cargo registry and build artifacts
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-python-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: ${{ runner.os }}-cargo-python-

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.12"

      - name: Install Python dependencies
        run: |
          python -m venv .venv
          .venv/bin/pip install maturin pytest numpy scipy

      - name: Build Python extension
        # No `klu` here — the published wheel doesn't ship it either (see
        # pypi.yml and Cargo.toml's `python`/`klu` feature doc comments:
        # klu vendors LGPL-2.1-or-later SuiteSparse source and needs a C
        # compiler + libclang, both extra weight this CI job doesn't need).
        run: .venv/bin/maturin develop --release --features python

      - name: Run Python tests
        run: .venv/bin/pytest python/tests/ -v