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.
This commit is contained in:
Bruno Ramirez
2026-12-01 09:13:57 -08:00
committed by GitHub
parent cf59298934
commit a0ff67e13e
6 changed files with 140 additions and 11 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/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"
+7
View File
@@ -0,0 +1,7 @@
# LanceDB CLI
Install with `pipx install lancedb-tools` or run `uvx --from lancedb-tools lancedb --help`.
When a compatible wheel is unavailable, the Python installer builds the native
`lancedb` executable with Cargo. Install Rust through rustup, a C/C++ toolchain,
CMake and `protoc` before building. On Intel macOS, use the Xcode Command Line Tools.
Cargo downloads the dependencies pinned in the release's `Cargo.lock`.
+6
View File
@@ -0,0 +1,6 @@
include Cargo.toml Cargo.lock rust-toolchain.toml CLI_VERSION
graft rust
# Cargo reads the manifests and targets of sibling workspace members when resolving the lockfile.
recursive-include nodejs *.toml *.rs
recursive-include python *.toml *.rs
recursive-include docs/web-tests *.toml *.rs
+26
View File
@@ -0,0 +1,26 @@
[build-system]
requires = ["setuptools>=68", "setuptools-rust>=1.9"]
build-backend = "setuptools.build_meta"
[project]
name = "lancedb-tools"
dynamic = ["version"]
description = "Command-line client for LanceDB SQL, profiles, and authentication"
requires-python = ">=3.8"
license = {text = "Apache-2.0"}
readme = "CLI_README.md"
[project.urls]
Source = "https://github.com/lancedb/lancedb"
[tool.setuptools]
packages = []
license-files = ["LICENSE", "RUST_THIRD_PARTY_LICENSES.html"]
[tool.setuptools.dynamic]
version = {file = "CLI_VERSION"}
[[tool.setuptools-rust.bins]]
target = "lancedb"
path = "rust/lancedb/cli/Cargo.toml"
cargo-manifest-args = ["--locked"]