Skip to content
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 11 additions & 1 deletion .bumpversion.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ filename = "python/Makefile"
search = "VERSION = {current_version}"
replace = "VERSION = {new_version}"

[[tool.bumpversion.files]]
filename = "cpp/Makefile"
search = "VERSION = {current_version}"
replace = "VERSION = {new_version}"

[[tool.bumpversion.files]]
filename = "rust/Makefile"
search = "VERSION = {current_version}"
Expand Down Expand Up @@ -76,6 +81,12 @@ filename = "rust/reqwest-client.toml"
search = 'version = "{current_version}"'
replace = 'version = "{new_version}"'

# C++ version header
[[tool.bumpversion.files]]
filename = "cpp/include/lance_namespace/version.h"
search = 'LANCE_NAMESPACE_VERSION_STRING "{current_version}"'
replace = 'LANCE_NAMESPACE_VERSION_STRING "{new_version}"'

# Python lance_namespace package
[[tool.bumpversion.files]]
filename = "python/lance_namespace/pyproject.toml"
Expand All @@ -88,7 +99,6 @@ filename = "python/lance_namespace/pyproject.toml"
search = 'lance-namespace-urllib3-client=={current_version}'
replace = 'lance-namespace-urllib3-client=={new_version}'


# Java lance-namespace-core module
[[tool.bumpversion.files]]
filename = "java/lance-namespace-core/pom.xml"
Expand Down
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ labels:
- label: rust
files:
- "rust\\/.*"
- label: cpp
files:
- "cpp\\/.*"
- label: spec
files:
- "spec\\/.*"
122 changes: 122 additions & 0 deletions .github/workflows/cpp-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: C/C++ Publish

on:
release:
types:
- released
pull_request:
paths:
- .github/workflows/cpp-publish.yml
- cpp/**
workflow_dispatch:
inputs:
mode:
description: 'Release mode'
required: true
type: choice
default: dry_run
options:
- dry_run
- release
ref:
description: 'The branch, tag or SHA to checkout'
required: false
type: string

jobs:
publish:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
full_build: true
asset_suffix: linux-x86_64
- os: macos-14
full_build: false
asset_suffix: macos-arm64
- os: windows-2022
full_build: false
asset_suffix: windows-x64

runs-on: ${{ matrix.os }}
permissions:
contents: write
defaults:
run:
shell: bash

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || inputs.ref || '' }}

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

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

- name: Install dependencies
run: uv sync --all-packages

- name: Resolve SDK version
id: version
run: |
python - <<'PY' >> "$GITHUB_OUTPUT"
from pathlib import Path

for line in Path("cpp/Makefile").read_text().splitlines():
if line.startswith("VERSION = "):
print(f"version={line.split('=', 1)[1].strip()}")
break
else:
raise SystemExit("VERSION not found in cpp/Makefile")
PY

- name: Build full C/C++ SDK
if: ${{ matrix.full_build }}
working-directory: cpp
run: make build

- name: Build C/C++ core
if: ${{ !matrix.full_build }}
working-directory: cpp
run: |
cmake -S lance_namespace -B lance_namespace/build -DCMAKE_BUILD_TYPE=Release
cmake --build lance_namespace/build --parallel 2
ctest --test-dir lance_namespace/build --output-on-failure --parallel 2

- name: Package release asset
working-directory: cpp
run: |
uv run python package_release.py \
--root . \
--output "dist/lance-namespace-cpp-${{ steps.version.outputs.version }}-${{ matrix.asset_suffix }}.tar.gz" \
--build-dir build \
--dist-dir dist

- name: Upload release asset
if: |
(github.event_name == 'release' && github.event.action == 'released') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.mode == 'release')
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.release.tag_name || inputs.ref || '' }}
files: cpp/dist/*.tar.gz
token: ${{ secrets.LANCE_RELEASE_TOKEN }}
79 changes: 79 additions & 0 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: C/C++

on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- ready_for_review
- reopened
paths:
- docs/src/spec.yaml
- cpp/**
- .github/workflows/cpp.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
full_build: true
- os: macos-14
full_build: false
- os: windows-2022
full_build: false

runs-on: ${{ matrix.os }}
timeout-minutes: 60
defaults:
run:
shell: bash

steps:
- name: Checkout lance-namespace repo
uses: actions/checkout@v4

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

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

- name: Install dependencies
run: uv sync --all-packages

- name: Build full C/C++ SDK
if: ${{ matrix.full_build }}
working-directory: cpp
run: make build

- name: Build C/C++ core
if: ${{ !matrix.full_build }}
working-directory: cpp
run: |
cmake -S lance_namespace -B lance_namespace/build -DCMAKE_BUILD_TYPE=Release
cmake --build lance_namespace/build --parallel 2
ctest --test-dir lance_namespace/build --output-on-failure --parallel 2
10 changes: 6 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ or to add new clients and servers to be generated based on community demand.
In general, we welcome more generated components to be added as long as
the contributor is willing to set up all the automations for generation and publication.

For contributing changes to directory and REST namespaces, please go to the [lance](https://github.com/lance-format/lance) repo.
For contributing changes to directory and REST namespaces, please go to the [lance-c](https://github.com/lance-format/lance-c) repo for C/C++ and [lance](https://github.com/lance-format/lance) repo for other languages.

For contributing changes to implementations other than the directory and REST namespace,
or for adding new namespace implementations,
Expand All @@ -32,11 +32,11 @@ This is because Rust uses source code builds, and separating modules across repo

The dependency chain is: `lance-namespace` → `lance` → `lance-namespace-impls`

### Other Languages (e.g. Python, Java)
### Other Languages (e.g. Python, Java, C/C++)

For Python, Java, and other languages, the core `LanceNamespace` interface and generic connect functionality
are maintained in **this repository** (e.g., `lance-namespace` for Python, `lance-namespace-core` for Java).
The core [lance-format/lance](https://github.com/lance-format/lance) repository then imports these modules.
The core repos [lance-format/lance](https://github.com/lance-format/lance) and [lance-format/lance-c](https://github.com/lance-format/lance-c) then import these modules.

The reason for this import direction is that `lance-namespace-impls` (REST and directory namespace implementations)
are used in the Lance Python and Java bindings, and are exposed back through the corresponding language interfaces.
Expand Down Expand Up @@ -107,6 +107,8 @@ This repository currently contains the following components:
| Java Apache Client | Java | java/lance-namespace-apache-client | Generated Java Apache HTTP client for Lance REST Namespace |
| Java SpringBoot Server| Java | java/lance-namespace-springboot-server | Generated Java SpringBoot server for Lance REST Namespace |
| Rust Reqwest Client | Rust | rust/lance-namespace-reqwest-client | Generated Rust reqwest client for Lance REST Namespace |
| C/C++ Core | C/C++ | cpp/lance_namespace | Core LanceNamespace interface and connect functionality |
| C/C++ REST Client | C/C++ | cpp/lance_namespace_rest_client | Generated C/C++ REST client for Lance REST Namespace |


## Install uv
Expand Down Expand Up @@ -200,5 +202,5 @@ This section describes the CI/CD workflows for automated version management, rel
- Go to the [Releases page](../../releases) to review the draft
- Edit release notes if needed
- Click "Publish release" to:
- For stable releases: Trigger automatic publishing for Java, Python, Rust
- For stable releases: Trigger automatic publishing for Java, Python, Rust, and C/C++
- For preview releases: Create a beta release (not published)
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ gen-rust:
build-rust:
cd rust; make build

.PHONY: clean-cpp
clean-cpp:
cd cpp; make clean

.PHONY: sync gen-cpp
gen-cpp:
cd cpp; make gen

.PHONY: build-cpp
build-cpp:
cd cpp; make build

.PHONY: clean-python
clean-python:
cd python; make clean
Expand Down Expand Up @@ -63,10 +75,10 @@ sync:
uv sync --all-packages

.PHONY: clean
clean: clean-rust clean-python clean-java
clean: clean-rust clean-cpp clean-python clean-java

.PHONY: gen
gen: lint gen-rust gen-python gen-java
gen: lint gen-rust gen-cpp gen-python gen-java

.PHONY: build
build: lint build-docs build-rust build-python build-java
build: lint build-docs build-rust build-cpp build-python build-java
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ that compute engines can integrate against:
| Python | `lance-namespace` | Core interface and connect functionality |
| Java | `org.lance:lance-namespace-core` | Core interface for Spark, Flink, Kafka, Trino, Presto |
| Rust | `lance-namespace` | Core interface (in [lance-format/lance](https://github.com/lance-format/lance)) |
| C/C++ | `lance-namespace-cpp` | Core interface and connect functionality |

## Resources

Expand Down
71 changes: 71 additions & 0 deletions cpp/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

VERSION = 0.8.7-beta.1
BUILD_DIR ?= build
GENERATED_DIR ?= lance_namespace_rest_client
DIST_DIR ?= dist
JOBS ?= $(shell nproc 2>/dev/null || echo 1)

.PHONY: clean-rest-client
clean-rest-client:
rm -rf $(GENERATED_DIR)

.PHONY: gen-rest-client
gen-rest-client: clean-rest-client
uv run openapi-generator-cli generate \
-i ../docs/src/spec.yaml \
-g cpp-restsdk \
-o $(GENERATED_DIR) \
--additional-properties=packageName=lance_namespace_rest_client,packageVersion=$(VERSION);
uv run python -c "from pathlib import Path; p = Path('$(GENERATED_DIR)/CMakeLists.txt'); text = p.read_text(); text = text.replace('cmake_minimum_required (VERSION 3.5)', 'cmake_minimum_required (VERSION 3.20)'); text = text.replace('set(CXX_STANDARD_REQUIRED ON)', 'set(CMAKE_CXX_STANDARD_REQUIRED ON)\\nset(CMAKE_CXX_STANDARD 17)'); p.write_text(text)"
rm -rf $(GENERATED_DIR)/.openapi-generator
rm -f $(GENERATED_DIR)/.gitignore $(GENERATED_DIR)/git_push.sh $(GENERATED_DIR)/.openapi-generator-ignore

.PHONY: build-rest-client
build-rest-client: gen-rest-client
cd $(GENERATED_DIR); \
cmake -S . -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=Release; \
cmake --build $(BUILD_DIR) --parallel $(JOBS); \
ctest --test-dir $(BUILD_DIR) --output-on-failure --parallel $(JOBS);

# lance_namespace package (hand-written, no codegen)
.PHONY: clean-core
clean-core:
cd lance_namespace; \
rm -rf $(BUILD_DIR) $(DIST_DIR);

.PHONY: build-core
build-core:
cd lance_namespace; \
cmake -S . -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=Release; \
cmake --build $(BUILD_DIR) --parallel $(JOBS); \
ctest --test-dir $(BUILD_DIR) --output-on-failure --parallel $(JOBS);


.PHONY: clean
clean: clean-rest-client clean-core

.PHONY: gen
gen: gen-rest-client

.PHONY: build
build: build-rest-client build-core


.PHONY: publish
publish: build
uv run python package_release.py \
--root . \
--output $(DIST_DIR)/lance-namespace-cpp-$(VERSION).tar.gz \
--build-dir $(BUILD_DIR) \
--dist-dir $(DIST_DIR);
Loading
Loading