Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "0.5.4"
current_version = "0.1.0"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(-(?P<pre_label>alpha|beta|rc)\\.(?P<pre_n>\\d+))?"
serialize = [
"{major}.{minor}.{patch}-{pre_label}.{pre_n}",
Expand Down
54 changes: 0 additions & 54 deletions .github/workflows/build.yml

This file was deleted.

209 changes: 169 additions & 40 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,205 @@
# Build, test and publish lance-csr wheels: Linux x86-64 (manylinux_2_28) and native
# Apple Silicon (macOS arm64), plus an sdist for every other platform.
#
# Pull requests that touch packaging build and test the wheels without publishing.
# A published GitHub release (tag vX.Y.Z) publishes to PyPI after every build and test
# passes, through PyPI trusted publishing and the protected `pypi` environment; so does
# a manual run with mode=release. mode=dry_run builds and tests only.
name: Python Publish

on:
release:
types:
- released
- published
pull_request:
paths:
- .github/workflows/python-publish.yml
- ci/check_wheel.py
- python/pyproject.toml
- python/.cargo/**
- crates/lance-graph-python/Cargo.toml
- crates/lance-graph-python/Cargo.lock
workflow_dispatch:
inputs:
mode:
description: "dry_run: build & test only, release: build & publish to PyPI"
description: "dry_run: build and test only; release: build, test and publish to PyPI"
required: true
default: dry_run
type: choice
options:
- dry_run
- release

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"

jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
build-linux:
# Built on the host with zig as the linker, targeting glibc 2.28 (RHEL 8, Ubuntu 20.04
# and newer); the same command produced the alpha's tested Linux wheels.
runs-on: ubuntu-24.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install build dependencies
run: |
# protoc is needed by Lance's build scripts, not by wheel users.
sudo apt-get update
sudo apt-get install -y protobuf-compiler
pip install ziglang

- name: Build manylinux_2_28 x86-64 wheel
uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad # v1
with:
command: build
working-directory: python
target: x86_64-unknown-linux-gnu
container: "off"
sccache: "true"
args: --release --locked --strip --zig --compatibility manylinux_2_28 --out dist

- name: Build sdist
uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad # v1
with:
command: sdist
working-directory: python
args: --out dist

- name: Inspect distributions
working-directory: python
run: |
pip install twine
twine check dist/*
sha256sum dist/*

- uses: actions/upload-artifact@v4
with:
name: python-dist-linux
path: python/dist/*
if-no-files-found: error

build-macos:
# GitHub's macos-14 runners are Apple Silicon, so this builds natively.
runs-on: macos-14
timeout-minutes: 90
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-C debuginfo=1"
RUST_BACKTRACE: "1"
CARGO_INCREMENTAL: "0"
MACOSX_DEPLOYMENT_TARGET: "11.0"
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/checkout@v4

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

- name: Install build dependencies
run: brew install protobuf

- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build Apple Silicon wheel
uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad # v1
with:
toolchain: stable
cache: false
command: build
working-directory: python
target: aarch64-apple-darwin
sccache: "true"
args: --release --locked --strip --out dist

- name: Install system dependencies
- name: Inspect wheel
working-directory: python
run: |
sudo apt update
sudo apt install -y protobuf-compiler libssl-dev
pip install twine
twine check dist/*.whl
shasum -a 256 dist/*.whl

- name: Install uv
uses: astral-sh/setup-uv@v4
- uses: actions/upload-artifact@v4
with:
name: python-dist-macos-arm64
path: python/dist/*.whl
if-no-files-found: error

- name: Install maturin
test:
# The wheels are abi3 (CPython 3.12+), so each platform's single wheel is tested on
# every supported Python, in a clean environment with Rust removed from PATH: a wheel
# that silently needed compiling would fail here.
needs: [build-linux, build-macos]
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-14]
python: ["3.12", "3.13", "3.14"]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
ci
python/python/tests

- uses: astral-sh/setup-uv@v4

- uses: actions/download-artifact@v4
with:
pattern: python-dist-*
merge-multiple: true
path: dist

- name: Install the wheel and run the test suite outside the source tree
shell: bash
run: |
pip install maturin
export PATH=$(echo "$PATH" | tr ':' '\n' | grep -v -e cargo -e rustup | paste -sd: -)
! command -v cargo && ! command -v rustc
uv venv --python ${{ matrix.python }} "$RUNNER_TEMP/venv"
py="$RUNNER_TEMP/venv/bin/python"
uv pip install --python "$py" --only-binary=:all: --find-links dist lance-csr pytest pandas
"$py" -I ci/check_wheel.py
cp -r python/python/tests "$RUNNER_TEMP/tests"
cd "$RUNNER_TEMP"
"$py" -I -m pytest "$RUNNER_TEMP/tests" -q -p no:cacheprovider

- name: Build distributions
working-directory: python
publish:
needs: [build-linux, build-macos, test]
if: >
github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.mode == 'release')
runs-on: ubuntu-24.04
environment:
name: pypi
url: https://pypi.org/project/lance-csr/
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: python/pyproject.toml

- name: Check the release tag matches the package version
if: github.event_name == 'release'
run: |
make publish
version=$(grep -m1 '^version = ' python/pyproject.toml | cut -d'"' -f2)
test "${{ github.event.release.tag_name }}" = "v$version" || {
echo "Release tag ${{ github.event.release.tag_name }} does not match version $version"; exit 1; }

- name: Upload distributions
uses: actions/upload-artifact@v4
- uses: actions/download-artifact@v4
with:
name: python-dist
path: python/dist
pattern: python-dist-*
merge-multiple: true
path: dist

- uses: astral-sh/setup-uv@v4

- name: Publish to PyPI
if: >
(github.event_name == 'release' && github.event.action == 'released') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.mode == 'release')
working-directory: python
run: |
uv publish --trusted-publishing always
run: uv publish --trusted-publishing always dist/*
17 changes: 8 additions & 9 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
paths:
- python/**
- crates/lance-graph/**
- crates/**
- Cargo.toml
- Cargo.lock
- .github/workflows/python-test.yml
Expand All @@ -26,7 +26,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -37,10 +37,9 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
with:
shared-key: "lance-graph-deps"
workspaces: |
crates/lance-graph
crates/lance-graph-python
shared-key: "lance-csr-python"
# maturin builds the bindings crate, which sits outside the workspace.
workspaces: crates/lance-graph-python
- name: Install dependencies
run: |
sudo apt update
Expand Down Expand Up @@ -69,8 +68,8 @@ jobs:
working-directory: python
run: |
source .venv/bin/activate
if [ -f python/lance_graph/__init__.py ]; then
python -m doctest python/lance_graph/__init__.py || echo "No doctests found"
if [ -f python/lance_csr/__init__.py ]; then
python -m doctest python/lance_csr/__init__.py || echo "No doctests found"
fi

lint:
Expand All @@ -81,7 +80,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Install linting tools
Expand Down
Loading
Loading