peteksim 0.1.8

petekSim — the SIMULATION layer: dynamic/engineering appraisal (recoverable/forecast) + PVT + the appraisal facade over the petek subsurface-modelling stack, consolidated into one crate.
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:

env:
  CARGO_TERM_COLOR: always

jobs:
  rust:
    name: cargo build / clippy / test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt
      - uses: Swatinem/rust-cache@v2.9.1
      - name: fmt
        run: cargo fmt --all --check
      - name: clippy (warnings = errors)
        run: cargo clippy --workspace --all-targets -- -D warnings
      - name: build
        run: cargo build --workspace
      - name: test
        run: cargo test --workspace

  python:
    name: maturin develop + import
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
      - uses: actions/setup-python@v6
        with:
          python-version: "3.11"
      # maturin develop requires an activated virtualenv on the runner.
      - name: build + import smoke test
        run: |
          python -m venv .venv
          source .venv/bin/activate
          pip install maturin
          for attempt in 1 2 3 4 5 6; do
            maturin develop -m crates/srs-py/Cargo.toml && break
            if [ "$attempt" = "6" ]; then
              exit 1
            fi
            sleep $((attempt * 20))
          done
          python -c "import peteksim; print(peteksim.version())"

  wheels:
    # Build the abi3 wheel and import + run it across a Python matrix so a
    # toolchain regression (e.g. a pyo3 that can't link a new CPython — the
    # 0.24-vs-3.14 blocker) is caught here, not by users. abi3-py310 means one
    # wheel spans 3.10+, but we still build AND import on each interpreter so a
    # per-version link/ABI break surfaces.
    name: wheel build + run (py ${{ matrix.python-version }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        # 3.10 = the abi3 floor (abi3-py310, requires-python >=3.10); through
        # the latest stable CPython.
        python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2.9.1
      - uses: actions/setup-python@v6
        with:
          python-version: ${{ matrix.python-version }}
          allow-prereleases: true
      - name: install maturin
        run: pip install maturin
      - name: build release wheel
        run: maturin build --release -m crates/srs-py/Cargo.toml --out dist
      - name: install wheel + run run_box_model
        # Install the freshly built local wheel by path (never PyPI's peteksim);
        # runtime deps (petektools + petekstatic) resolve from PyPI.
        run: |
          for attempt in 1 2 3 4 5 6; do
            pip install --no-cache-dir --only-binary=:all: dist/peteksim-*.whl && break
            if [ "$attempt" = "6" ]; then
              exit 1
            fi
            sleep $((attempt * 20))
          done
          python - <<'PY'
          import peteksim
          r = peteksim.run_box_model(
              area_km2=(0.32, 0.4, 0.52), gross_height_m=(12, 15, 20),
              porosity=0.25, net_to_gross=0.8, water_saturation=0.3, fvf=1.25,
              fluid="oil", contact_m=2743, realizations=2000, seed=1,
          )
          assert r.p90 < r.p50 < r.p10, (r.p90, r.p50, r.p10)
          assert len(r.samples) == r.realizations == 2000
          print("peteksim", peteksim.version(), "ok:", r)
          PY