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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,5 @@ target/
/ci/linux-packages/yum/tmp/

# Meson subproject support
/c/subprojects/*
!/c/subprojects/*.wrap
**/subprojects/*
!**/subprojects/*.wrap
8 changes: 2 additions & 6 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,8 @@ if(ADBC_BUILD_PYTHON)
# but you don't technically need -DADBC_DRIVER_MANAGER=ON when installing
# other Python packages. To be safe then, we always install the driver
# manager package, regardless of the value of -DABC_DRIVER_MANAGER
# --config-settings eidtable_mode=compat required due to
# https://github.com/python/mypy/issues/13392
add_custom_target(python
COMMAND ${Python3_EXECUTABLE} -m pip install --no-deps -e
"${REPOSITORY_ROOT}/python/adbc_driver_manager"
--config-settings editable_mode=compat)
add_custom_target(python COMMAND ${Python3_EXECUTABLE} -m pip install --no-deps -e
"${REPOSITORY_ROOT}/python/adbc_driver_manager")

macro(adbc_install_python_package TARGET)
string(TOUPPER ${TARGET} ${TARGET}_LIB_upper)
Expand Down
4 changes: 2 additions & 2 deletions ci/scripts/python_sdist_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ echo "=== (${PYTHON_VERSION}) Building ADBC sdists ==="

# https://github.com/pypa/pip/issues/7555
# Get the latest pip so we have in-tree-build by default
pip install --upgrade pip setuptools
pip install --upgrade pip build

# For drivers, which bundle shared libraries, defer that to install time
export _ADBC_IS_SDIST=1
Expand All @@ -41,7 +41,7 @@ for component in ${COMPONENTS}; do
echo "=== Building $component sdist ==="
# python -m build copies to a tempdir, so we can't reference other files in the repo
# https://github.com/pypa/pip/issues/5519
python setup.py sdist
python -m build --sdist .

popd
done
4 changes: 2 additions & 2 deletions ci/scripts/python_wheel_unix_relocate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fi
echo "=== Relocating wheels ==="
# https://github.com/pypa/pip/issues/7555
# Get the latest pip so we have in-tree-build by default
python -m pip install --upgrade pip auditwheel 'cibuildwheel>=2.21.2' delocate setuptools wheel
python -m pip install --upgrade pip auditwheel 'cibuildwheel>=2.21.2' delocate build wheel

# Build with Cython debug info
export ADBC_BUILD_TYPE="debug"
Expand All @@ -76,7 +76,7 @@ for component in $COMPONENTS; do
# container during build, but it only copies the package
# directory, which omits the C++ sources and .git directory,
# causing the build to fail.
python setup.py sdist
python -m build --sdist .
if [[ "$component" = "adbc_driver_manager" ]]; then
python -m cibuildwheel --output-dir repaired_wheels/ dist/$component-*.tar.gz
else
Expand Down
1 change: 1 addition & 0 deletions dev/release/rat_exclude_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ go/adbc/status_string.go
go/adbc/infocode_string.go
go/adbc/go.sum
java/.mvn/jvm.config
python/*/subprojects/arrow-adbc/*
python/*/*/py.typed
rat.txt
r/*/DESCRIPTION
Expand Down
44 changes: 44 additions & 0 deletions python/adbc_driver_manager/adbc_driver_manager/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.

py.extension_module(
'_backward',
sources: ['_backward.pyx'],
dependencies: [backward_dep],
include_directories: backward_incdir,
override_options: ['cython_language=cpp'],
install: true,
subdir: 'adbc_driver_manager',
)

py.extension_module(
'_lib',
sources: ['_blocking_impl.cc', '_lib.pyx'],
dependencies: [adbc_driver_manager_dep],
override_options: ['cython_language=cpp'],
install: true,
subdir: 'adbc_driver_manager',
)

py.extension_module(
'_reader',
sources: ['_reader.pyx'],
dependencies: [adbc_driver_manager_dep],
override_options: ['cython_language=cpp'],
install: true,
subdir: 'adbc_driver_manager',
)
58 changes: 58 additions & 0 deletions python/adbc_driver_manager/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.

project(
'adbc_driver_manager',
'cython',
version: run_command(
['python', 'adbc_driver_manager/_version.py'],
check: true,
).stdout().replace(
'Version:',
'',
).strip(),
license: 'Apache-2.0',
meson_version: '>=1.2.1',
default_options: [
'buildtype=release',
'warning_level=2',
'cpp_std=c++17',
# conda environments may only provide a static library for
# libbfd, which backward-cpp requires.
'default_library=static',
],
)

backward_dep = dependency('backward-cpp')
# hack until https://github.com/mesonbuild/wrapdb/pull/2072
backward_incdir = include_directories('subprojects/backward-cpp-1.6')

adbc_driver_manager_dep = dependency(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea here is that Meson can look for adbc-driver-manager through its typical its typical search mechanism (typically pkgconf). If it is not installed, Meson will look at subprojects/arrow-adbc, which symlinks to the C directory

One caveat to this is if a user is trying to locally develop on a system where the ADBC Driver Manager is installed, it will pick up the system dependency rather than the local one. If we wanted to prevent that we could add more logic potentially

'adbc-driver-manager',
fallback: ['arrow-adbc', 'adbc_driver_manager_dep'],
default_options: ['driver_manager=enabled'],
)
py = import('python').find_installation(pure: false)

cython_args = []
if get_option('buildtype') in ['debug', 'debugoptimized']
cython_args += ['--gdb']
endif

subdir('adbc_driver_manager')

meson.add_dist_script(py, files('scripts/remove_third_party_wraps.py'))
4 changes: 2 additions & 2 deletions python/adbc_driver_manager/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ homepage = "https://arrow.apache.org/adbc/"
repository = "https://github.com/apache/arrow-adbc"

[build-system]
requires = ["Cython", "setuptools >= 61.0.0"]
build-backend = "setuptools.build_meta"
requires = ["Cython", "meson-python"]
build-backend = "mesonpy"

[tool.pytest.ini_options]
markers = [
Expand Down
26 changes: 26 additions & 0 deletions python/adbc_driver_manager/scripts/remove_third_party_wraps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.

# This script is a workaround for the issue described in
# https://github.com/mesonbuild/meson/issues/14520

import os
import pathlib

dist_root = pathlib.Path(os.environ["MESON_DIST_ROOT"])
os.unlink(dist_root / "subprojects" / "nanoarrow.wrap")
os.unlink(dist_root / "subprojects" / "fmt.wrap")
130 changes: 0 additions & 130 deletions python/adbc_driver_manager/setup.py

This file was deleted.

1 change: 1 addition & 0 deletions python/adbc_driver_manager/subprojects/arrow-adbc
30 changes: 30 additions & 0 deletions python/adbc_driver_manager/subprojects/backward-cpp.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.

[wrap-file]
directory = backward-cpp-1.6
source_url = https://github.com/bombela/backward-cpp/archive/refs/tags/v1.6.tar.gz
source_filename = backward-cpp-1.6.tar.gz
source_hash = c654d0923d43f1cea23d086729673498e4741fb2457e806cfaeaea7b20c97c10
patch_filename = backward-cpp_1.6-3_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/backward-cpp_1.6-3/get_patch
patch_hash = 219b7a62f8f05037586ec90ba02b6d552d356f6f1d1171e5803bbe483daf69f0
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/backward-cpp_1.6-3/backward-cpp-1.6.tar.gz
wrapdb_version = 1.6-3

[provide]
backward-cpp = backward_dep
19 changes: 19 additions & 0 deletions python/adbc_driver_manager/subprojects/fmt.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.

[wrap-redirect]
filename = arrow-adbc/subprojects/fmt.wrap
Loading
Loading