Skip to content

Commit 932ccad

Browse files
committed
fix(ci): fix cibuildwheel builds across linux, macos, and free-threaded python
- Make copy_build_files robust when ../cpp is not present in isolated container mounts - Skip experimental free-threaded python builds (cp*t-*) in cibuildwheel - Bump macOS deployment target to 13.3 for C++20 std::format float support - Fix -Wbraced-scalar-init compiler warnings in pybind11 array constructors
1 parent d9472e0 commit 932ccad

7 files changed

Lines changed: 20 additions & 14 deletions

File tree

‎.github/workflows/BuildAndPublish.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242
CIBW_ARCHS: auto64
4343
CIBW_BUILD_FRONTEND: "pip; args: --verbose"
4444
CIBW_ENVIRONMENT: "FORCE_AVX2=1 CMAKE_BUILD_PARALLEL_LEVEL=4"
45-
CIBW_ENVIRONMENT_MACOS: "FORCE_AVX2=1 MACOSX_DEPLOYMENT_TARGET=11.00 CMAKE_BUILD_PARALLEL_LEVEL=4"
46-
CIBW_SKIP: "cp314t-* pp*win*"
45+
CIBW_ENVIRONMENT_MACOS: "FORCE_AVX2=1 MACOSX_DEPLOYMENT_TARGET=13.3 CMAKE_BUILD_PARALLEL_LEVEL=4"
46+
CIBW_SKIP: "cp*t-* pp*win*"
4747

4848
# upload artifacts
4949
- name: Upload Build Artifacts

‎.github/workflows/BuildAndTest.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ jobs:
3838
CIBW_ARCHS: auto64
3939
CIBW_BUILD_FRONTEND: "pip; args: --verbose"
4040
CIBW_ENVIRONMENT: "FORCE_AVX2=1 CMAKE_BUILD_PARALLEL_LEVEL=4"
41-
CIBW_ENVIRONMENT_MACOS: "FORCE_AVX2=1 MACOSX_DEPLOYMENT_TARGET=11.00 CMAKE_BUILD_PARALLEL_LEVEL=4"
42-
CIBW_SKIP: "cp314t-* pp*win*"
41+
CIBW_ENVIRONMENT_MACOS: "FORCE_AVX2=1 MACOSX_DEPLOYMENT_TARGET=13.3 CMAKE_BUILD_PARALLEL_LEVEL=4"
42+
CIBW_SKIP: "cp*t-* pp*win*"
4343

4444
build_sdist:
4545
runs-on: ubuntu-latest

‎python/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ Build source distributions (`sdist`) and binary wheels:
7979
uv run python -m build
8080
```
8181

82-
To build manylinux/musllinux wheels for Linux distribution via PyPI:
82+
To build manylinux/musllinux wheels for Linux distribution via PyPI (ensure `copy_build_files` has been executed first):
8383
```bash
84+
uv run python setup.py copy_build_files
8485
cibuildwheel --archs auto64 --output-dir dist
8586
```
8687

‎python/pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ filterwarnings = [
5454
testpaths = ["tests"]
5555

5656
[tool.cibuildwheel]
57+
skip = "cp*t-* pp*win*"
5758
test-command = "pytest {project}"
5859
test-extras = ["test"]
5960

‎python/setup.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ def run(self):
5555
copy_dirs = [(os.path.join("..", "cpp"), "lib")]
5656

5757
for src, dst in copy_dirs:
58+
if not os.path.exists(src):
59+
if os.path.exists(dst) and any(Path(dst).iterdir()):
60+
print(f"Source '{src}' not found, but '{dst}' already exists and contains files. Skipping copy.")
61+
continue
62+
raise FileNotFoundError(f"Source directory '{src}' does not exist and '{dst}' is not populated.")
5863
print(f"Copying {src} to {dst}")
5964
shutil.copytree(src, dst, dirs_exist_ok=True, ignore=ignore_dirs)
6065
print("Files copied successfully.")

‎python/src/deg_cpp/deglib_cpp.cpp‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@ py::object graph_search_single_wrapper(
137137
}
138138

139139
const size_t count = result.size();
140-
py::array_t<uint32_t> result_indices({static_cast<py::ssize_t>(count)});
140+
py::array_t<uint32_t> result_indices(static_cast<py::ssize_t>(count));
141141
py::buffer_info result_indices_info = result_indices.request();
142142
auto result_indices_ptr = static_cast<uint32_t*>(result_indices_info.ptr);
143143

144144
py::array_t<float> result_distances;
145145
float* result_distances_ptr = nullptr;
146146
if (return_distances) {
147-
result_distances = py::array_t<float>({static_cast<py::ssize_t>(count)});
147+
result_distances = py::array_t<float>(static_cast<py::ssize_t>(count));
148148
result_distances_ptr = static_cast<float*>(result_distances.request().ptr);
149149
}
150150

@@ -374,14 +374,14 @@ py::object graph_explore_single_wrapper(
374374
}
375375

376376
const size_t count = result.size();
377-
py::array_t<uint32_t> result_indices({static_cast<py::ssize_t>(count)});
377+
py::array_t<uint32_t> result_indices(static_cast<py::ssize_t>(count));
378378
py::buffer_info result_indices_info = result_indices.request();
379379
auto result_indices_ptr = static_cast<uint32_t*>(result_indices_info.ptr);
380380

381381
py::array_t<float> result_distances;
382382
float* result_distances_ptr = nullptr;
383383
if (return_distances) {
384-
result_distances = py::array_t<float>({static_cast<py::ssize_t>(count)});
384+
result_distances = py::array_t<float>(static_cast<py::ssize_t>(count));
385385
result_distances_ptr = static_cast<float*>(result_distances.request().ptr);
386386
}
387387

@@ -416,11 +416,11 @@ graph_has_path_wrapper(const G& graph, const std::vector<uint32_t>& entry_vertex
416416
std::vector<deglib::search::ObjectDistance> path = graph.hasPath(entry_vertex_indices, to_vertex, eps, k);
417417

418418
const size_t count = path.size();
419-
py::array_t<uint32_t> result_indices({static_cast<py::ssize_t>(count)});
419+
py::array_t<uint32_t> result_indices(static_cast<py::ssize_t>(count));
420420
py::buffer_info result_indices_info = result_indices.request();
421421
auto result_indices_ptr = static_cast<uint32_t*>(result_indices_info.ptr);
422422

423-
py::array_t<float> result_distances({static_cast<py::ssize_t>(count)});
423+
py::array_t<float> result_distances(static_cast<py::ssize_t>(count));
424424
py::buffer_info result_distances_info = result_distances.request();
425425
auto result_distances_ptr = static_cast<float*>(result_distances_info.ptr);
426426

@@ -534,12 +534,12 @@ std::tuple<py::array_t<uint32_t>, py::array_t<float>> dynamic_exploration_graph_
534534
) {
535535
deglib::search::ResultSet result = graph.explore(entry_external_label, k, max_distance_computation_count, eps, include_entry, filter);
536536

537-
py::array_t<uint32_t> result_indices({static_cast<py::ssize_t>(k)});
537+
py::array_t<uint32_t> result_indices(static_cast<py::ssize_t>(k));
538538
py::buffer_info result_indices_info = result_indices.request();
539539
auto result_indices_ptr = static_cast<uint32_t*>(result_indices_info.ptr);
540540
std::fill_n(result_indices_ptr, k, 0);
541541

542-
py::array_t<float> result_distances({static_cast<py::ssize_t>(k)});
542+
py::array_t<float> result_distances(static_cast<py::ssize_t>(k));
543543
py::buffer_info result_distances_info = result_distances.request();
544544
auto result_distances_ptr = static_cast<float*>(result_distances_info.ptr);
545545
std::fill_n(result_distances_ptr, k, std::numeric_limits<float>::quiet_NaN());

‎python/src/deglib/builder.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def __init__(
7979
self.graph = graph
8080
self.optimization_target = optimization_target
8181

82-
8382
def add_entry(self, external_label: int | Iterable[int] | np.ndarray, feature: np.ndarray):
8483
"""
8584
Provide the builder with new entries to be added to the graph during the build process.

0 commit comments

Comments
 (0)