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\\/.*"
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
43 changes: 43 additions & 0 deletions cpp/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Lance Namespace C++ SDK — clang-format configuration
# Enforced by clang-format-20. Run: clang-format-20 -i <file>

BasedOnStyle: Google
Standard: c++20
ColumnLimit: 100

# Indent
IndentWidth: 2
ContinuationIndentWidth: 4
AccessModifierOffset: -1

# Braces
BreakBeforeBraces: Attach

# Include sorting
IncludeBlocks: Regroup
IncludeCategories:
# Own headers first (lance_namespace/*)
- Regex: '^<lance_namespace/'
Priority: 1
# System / third-party
- Regex: '^<'
Priority: 2
# Relative includes
- Regex: '.*'
Priority: 3
SortIncludes: CaseSensitive

# Pointer alignment
PointerAlignment: Left
ReferenceAlignment: Left

# Misc
AlignTrailingComments:
Kind: Always
OverEmptyLines: 1
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
BinPackArguments: false
BinPackParameters: false
SpaceBeforeParens: ControlStatements
45 changes: 45 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright The Lance Authors

cmake_minimum_required(VERSION 3.22)

project(LanceNamespace
VERSION 0.8.7
DESCRIPTION "C/C++ SDK for the Lance Namespace interface"
HOMEPAGE_URL "https://github.com/lance-format/lance-namespace"
LANGUAGES C CXX
)

# ─── Standards — match lance-c ───────────────────────────────────────────────
if(NOT DEFINED CMAKE_C_STANDARD OR CMAKE_C_STANDARD LESS 11)
set(CMAKE_C_STANDARD 11)
endif()
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)

if(NOT DEFINED CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS 20)
set(CMAKE_CXX_STANDARD 20)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# ─── Default build type ───────────────────────────────────────────────────────
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()

# ─── Options ─────────────────────────────────────────────────────────────────
option(LANCE_NAMESPACE_BUILD_SHARED "Build lance_namespace as a shared library" OFF)
option(LANCE_NAMESPACE_BUILD_TESTS "Build unit tests" ON)

if(LANCE_NAMESPACE_BUILD_TESTS)
enable_testing()
endif()

# ─── Subdirectories ──────────────────────────────────────────────────────────
add_subdirectory(lance_namespace)

if(IS_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/lance_namespace_rest_client" AND
EXISTS "${CMAKE_CURRENT_LIST_DIR}/lance_namespace_rest_client/CMakeLists.txt")
add_subdirectory(lance_namespace_rest_client)
endif()
85 changes: 85 additions & 0 deletions cpp/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# 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
SPEC = ../docs/src/spec.yaml
NPROC := $(shell nproc 2>/dev/null || sysctl -n hw.logicalcpu 2>/dev/null || echo 4)
CLANG_FMT ?= clang-format-20

# ─── REST client (cpp-restsdk, generated) ────────────────────────────────────

.PHONY: clean-rest-client
clean-rest-client:
rm -rf lance_namespace_rest_client/include \
lance_namespace_rest_client/src \
lance_namespace_rest_client/model \
lance_namespace_rest_client/api \
lance_namespace_rest_client/CMakeLists.txt
mkdir -p lance_namespace_rest_client

.PHONY: gen-rest-client
gen-rest-client: clean-rest-client
uv run openapi-generator-cli generate \
-i $(SPEC) \
-g cpp-restsdk \
-o lance_namespace_rest_client \
--additional-properties=packageName=LanceNamespace,packageVersion=$(VERSION),httpUserAgent=lance-namespace-cpp/$(VERSION)
rm -rf lance_namespace_rest_client/.openapi-generator
rm -f lance_namespace_rest_client/.gitignore
rm -f lance_namespace_rest_client/git_push.sh
@echo "REST client generated. Update lance_namespace_rest_client/include/lance_namespace_rest_client/lance_namespace.hpp manually if new models were added."

# ─── Core build ──────────────────────────────────────────────────────────────

.PHONY: build-core
build-core:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel $(NPROC)

.PHONY: test-core
test-core: build-core
cd build && ctest --output-on-failure -j$(NPROC)

# ─── clang-format ────────────────────────────────────────────────────────────

SOURCES := $(shell find lance_namespace/include lance_namespace/src lance_namespace/tests \
-name '*.cpp' -o -name '*.h' -o -name '*.hpp' 2>/dev/null)

.PHONY: format
format:
$(CLANG_FMT) -i $(SOURCES)

.PHONY: format-check
format-check:
@DIFF=$$($(CLANG_FMT) --dry-run --Werror $(SOURCES) 2>&1); \
if [ -n "$$DIFF" ]; then \
echo "$$DIFF"; \
echo "Run 'make format' to fix formatting."; \
exit 1; \
fi
@echo "All files pass clang-format-20."

# ─── Phony aggregates ────────────────────────────────────────────────────────

.PHONY: clean
clean: clean-rest-client
rm -rf build

.PHONY: gen
gen: gen-rest-client

.PHONY: build
build: gen build-core

.PHONY: test
test: test-core

Loading
Loading