name: Python Bindings
on:
workflow_dispatch:
pull_request:
paths:
- "bindings/python/**"
- "crates/core/src/error.rs"
- "MODULE.bazel"
- "BUILD.bazel"
- ".bazelrc"
- ".cargo/**"
- ".bazelversion"
- ".github/workflows/python-bindings.yml"
push:
branches: [main]
paths:
- "bindings/python/**"
- "crates/core/src/error.rs"
- "MODULE.bazel"
- "BUILD.bazel"
- ".bazelrc"
- ".cargo/**"
- ".bazelversion"
- ".github/workflows/python-bindings.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
bazel:
name: Bazel build and test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-latest]
env:
USE_BAZEL_VERSION: "9.3.0"
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Bazel
uses: bazel-contrib/setup-bazel@0.19.1
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-${{ github.job }}
repository-cache: true
external-cache: true
- name: Build the Python package and native extension
run: bazel build //bindings/python:hawdb
- name: Test the Bazel extension and dependency lock
run: bazel test //bindings/python/...
test:
name: Build and test
runs-on: ubuntu-24.04
defaults:
run:
working-directory: bindings/python
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@1.97.1
with:
components: clippy, rustfmt
- name: Install Python
uses: actions/setup-python@v7
with:
python-version: "3.11"
- name: Install maturin and pytest
run: pip install "maturin>=1.8,<2.0" "pytest>=8.0"
- name: Build the extension wheel
run: maturin build --release --out dist
- name: Test capsule unwind containment and error retry classification
run: cargo test --release --locked --lib -- retained::arrow::destructor_tests errors::tests --test-threads=1
- name: Install the built wheel
run: pip install dist/*.whl
- name: Run tests
run: pytest
- name: Install the pydantic extra
run: pip install "$(echo dist/*.whl)[pydantic]"
- name: Run tests with the pydantic extra
run: pytest tests/test_pydantic*.py
- name: Provision the optional public Arrow consumer
run: pip install "pyarrow==26.0.0"
- name: Test public Arrow protocols against the installed wheel
run: |
python -c 'import pyarrow; print(pyarrow.__version__)'
pytest tests/test_arrow_consumer.py