Files
lancedb/ci/cli_wheel/build_sdist.sh
T
Bruno Ramirez a0ff67e13e feat(cli): publish a source distribution for lancedb-tools (#5314)
The `lancedb-tools` release contains wheels for Apple Silicon and two
Linux architectures. Users on Intel macOS have no compatible wheel, so
the Python installer has no way to install the CLI. This extends the
release workflow from #5313 to build a source distribution from the same
tag and check the source fallback before the release team approves
publication.

This was accomplished with the following changes:

- Package the tagged Rust CLI, workspace manifests, lockfile, and
licenses with a setuptools-rust binary target.
- Install by package name on a native Intel macOS runner with all four
release files available, then check that pip selected the sdist and
built a working x86-64 executable.
- Upload the tested sdist alongside the wheels and verify its published
SHA-256 digest.
2026-12-01 09:13:57 -08:00

27 lines
1004 B
Bash

#!/usr/bin/env bash
set -euo pipefail
commit=${1:?pass the resolved release commit}
tag=${2:?pass the published release tag}
out=${3:?pass the distribution output directory}
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
# Keep root-level build hooks and Python modules from the release out of the
# build context. The Rust workspace is input data for the sdist.
git archive --format=tar --output="$work/source.tar" "$commit" -- \
.bumpversion.toml Cargo.toml Cargo.lock rust-toolchain.toml \
LICENSE RUST_THIRD_PARTY_LICENSES.html README.md rust nodejs python docs/web-tests
stage="$work/source"
python -m tarfile --filter data -e "$work/source.tar" "$stage"
python - "$stage" "$tag" <<'PY' > "$stage/CLI_VERSION"
import sys
from pathlib import Path
from ci.package_cli import release_version
print(release_version(Path(sys.argv[1]), f"refs/tags/{sys.argv[2]}"))
PY
cp ci/cli_wheel/sdist/{pyproject.toml,MANIFEST.in,CLI_README.md} "$stage/"
python -I -m build --sdist --outdir "$out" "$stage"