Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip musllinux for now; fix CI #1

Merged
merged 25 commits into from
Oct 4, 2024
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
- uses: actions/checkout@v2
- uses: pre-commit/[email protected]

sanitizer-tests:
name: Run sanitizers on ${{ matrix.os }}
cpp-tests:
name: Run C++ tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -32,14 +32,21 @@ jobs:

- name: Install test dependencies
run: |
python -m pip install meson
python -m pip install meson ninja

- name: Build with sanitizers
run: |
meson setup builddir -Db_sanitize=address,undefined
meson setup builddir -Db_sanitize="address,undefined"
meson compile -C builddir
if: ${{ matrix.os != 'windows-2022' }}

- name: Test with sanitizers
- name: Build
run: |
meson setup builddir
meson compile -C builddir
if: ${{ matrix.os == 'windows-2022' }}

- name: Test
run: |
meson test -C builddir

Expand All @@ -61,3 +68,7 @@ jobs:
uses: pypa/[email protected]
env:
MACOSX_DEPLOYMENT_TARGET: "10.14"

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
3 changes: 2 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ project(
default_options: [
'warning_level=2',
'cpp_std=c++17',
'default_library=static',
],
)

Expand All @@ -25,7 +26,7 @@ impl_test = executable(
sources: ['src/pandas-mask/pandas_mask_impl_test.cc'],
dependencies: [gtest_dep, impl_dep],
)
test('bitmask-impl', impl_test)
test('pandas-mask-impl', impl_test)

py.extension_module(
'pandas_mask',
Expand Down
21 changes: 18 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
[build-system]
requires = [
# meson-python needs to be pinned on windows to work around
# https://github.com/mesonbuild/meson-python/issues/525
'meson-python',
'meson',
'cmake', # for nanobind
'wheel',
]

build-backend= 'mesonpy'

[project]
name = 'pd-bitmask'
name = 'pandas_mask'
dynamic = ['version']
description = 'Bitmask implementation for pandas which adheres to the buffer protocol'
description = 'Bitmask implementation for pandas which has select NumPy compatability'
authors = [
{ name = 'Will Ayd', email='[email protected]' },
]
Expand All @@ -32,3 +33,17 @@ classifiers = [
'Programming Language :: Python :: 3.12',
'Topic :: Scientific/Engineering'
]

[tool.cibuildwheel]
build = "cp39-*64 cp310-*64 cp311-*64 cp312-*64"
skip = "*musllinux*"

test-command = "pytest {project}/tests"
test-requires = ["pytest", "numpy"]

[tool.meson-python.args]
install = ['--skip-subprojects']

[tool.cibuildwheel.windows]
before-build = "pip install delvewheel"
repair-wheel-command = "delvewheel repair --add-path C:/Windows/System32 -w {dest_dir} {wheel}"
11 changes: 7 additions & 4 deletions src/pandas-mask/pandas_mask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ class PandasMaskArray {
return nb::steal(py_bytes);
}

auto NdArray(nb::object) const noexcept -> np_arr_type {
// TODO: right now we just ignore dtype, but maybe we should validate it?
auto NdArray(nb::object, bool) const noexcept -> np_arr_type {
// TODO: right now we just ignore args and kwargs, but maybe we shouldn't?
const auto nelems = pImpl_->Length();
bool *data = new bool[nelems];
ArrowBitsUnpackInt8(pImpl_->bitmap_->buffer.data, 0, nelems,
Expand Down Expand Up @@ -266,7 +266,9 @@ NB_MODULE(pandas_mask, m) {
.def("__or__", &PandasMaskArray::BinOp<std::bit_or<>>)
.def("__xor__", &PandasMaskArray::BinOp<std::bit_xor<>>)
.def("__getstate__",
[](const PandasMaskArray &bma) { return bma.NdArray(nb::none()); })
[](const PandasMaskArray &bma) {
return bma.NdArray(nb::none(), false);
})
.def("__setstate__",
[](PandasMaskArray &bma, const np_arr_type &state) {
new (&bma) PandasMaskArray(state);
Expand Down Expand Up @@ -304,5 +306,6 @@ NB_MODULE(pandas_mask, m) {
[](const PandasMaskArray &bma) noexcept {
return PandasMaskArray(bma.pImpl_->Copy());
})
.def("__array__", &PandasMaskArray::NdArray, "dtype"_a = nb::none());
.def("__array__", &PandasMaskArray::NdArray, "dtype"_a = nb::none(),
"copy"_a = false);
}
18 changes: 11 additions & 7 deletions subprojects/nanobind.wrap
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
[wrap-git]
method = cmake
url = https://github.com/wjakob/nanobind/
revision = v2.0.0
depth = 1
clone-recursive = true
[wrap-file]
directory = nanobind-2.1.0
source_url = https://github.com/wjakob/nanobind/archive/refs/tags/v2.1.0.tar.gz
source_filename = nanobind-2.1.0.tar.gz
source_hash = c37c53c60ada5fe1c956e24bd4b83af669a2309bf952bd251f36a7d2fa3bacf0
patch_filename = nanobind_2.1.0-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/nanobind_2.1.0-1/get_patch
patch_hash = 79f6511b10627e75067efb883765d7b8865633185cd22db733c8816239b8dd6c
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/nanobind_2.1.0-1/nanobind-2.1.0.tar.gz
wrapdb_version = 2.1.0-1

[provide]
nanobind = nanobind_static_dep
nanobind = nanobind_dep
13 changes: 13 additions & 0 deletions subprojects/robin-map.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[wrap-file]
directory = robin-map-1.3.0
source_url = https://github.com/Tessil/robin-map/archive/refs/tags/v1.3.0.tar.gz
source_filename = robin-map-1.3.0.tar.gz
source_hash = a8424ad3b0affd4c57ed26f0f3d8a29604f0e1f2ef2089f497f614b1c94c7236
patch_filename = robin-map_1.3.0-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/robin-map_1.3.0-1/get_patch
patch_hash = 6d090f988541ffb053512607e0942cbd0dbc2a4fa0563e44ff6a37e810b8c739
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/robin-map_1.3.0-1/robin-map-1.3.0.tar.gz
wrapdb_version = 1.3.0-1

[provide]
robin-map = robin_map_dep
Loading