Skip to content

Commit

Permalink
No limited api (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Jan 29, 2022
1 parent 9ee4c74 commit 90b1a46
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 34 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/build_python_wheels.yml
Expand Up @@ -7,8 +7,10 @@ on:

jobs:
build-macos:

runs-on: macos-latest
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10"]
env:
INSTALL_PREFIX: "/usr/local/miniconda/envs/hyperarrow"
LIB_LOCATION: "/usr/local/miniconda/envs/hyperarrow/lib"
Expand All @@ -17,7 +19,7 @@ jobs:
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.8
python-version: ${{ matrix.python_version }}
activate-environment: hyperarrow
channels: conda-forge
- name: Download Hyper Library / Headers
Expand Down Expand Up @@ -62,7 +64,7 @@ jobs:
- name: Upload wheel
uses: actions/upload-artifact@v2
with:
name: macos-3.8
name: macos-${{ matrix.python_version }}
path: ./*.whl
- name: Test wheel
shell: bash -l {0}
Expand All @@ -73,19 +75,22 @@ jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: ${{ matrix.python_version }}
- name: Build docker compose
run: docker-compose build python-wheel-manylinux-2014
run: PYTHON=${{ matrix.python_version }} docker-compose build python-wheel-manylinux-2014
- name: Run docker image
run: docker-compose up
- name: Upload wheel
uses: actions/upload-artifact@v2
with:
name: linux-3.8
name: linux-${{ matrix.python_version }}
path: python/repaired_wheels/*.whl
- name: Test wheel
run: |
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -35,7 +35,7 @@ find_package(Python COMPONENTS Interpreter)

if (Python_FOUND)
add_custom_target(python
COMMAND ${Python_EXECUTABLE} setup.py bdist_wheel --py-limited-api=cp38
COMMAND ${Python_EXECUTABLE} setup.py bdist_wheel
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/python
DEPENDS hyperarrow_writer hyperarrow_reader
)
Expand Down
4 changes: 3 additions & 1 deletion ci/docker/python-wheel-windows.dockerfile
Expand Up @@ -35,12 +35,14 @@ RUN setx path "%path%;C:\Program Files\Git\usr\bin"
RUN wmic product where "name like 'python%%'" call uninstall /nointeractive && \
rm -rf Python*

ARG python=3.8
ARG python
RUN (if "%python%"=="3.7" setx PYTHON_VERSION 3.7.12) & \
(if "%python%"=="3.8" setx PYTHON_VERSION 3.8.10) & \
(if "%python%"=="3.9" setx PYTHON_VERSION 3.9.9) & \
(if "%python%"=="3.10" setx PYTHON_VERSION 3.10.1)
RUN choco install -r -y --no-progress python --version=%PYTHON_VERSION%
# choco doesn't seem to add the Python install to the PATH with 3.9
RUN (if "%python%"=="3.9" setx PATH "C:\Python39;C:\Python39\Scripts;%PATH%")
RUN pip install -U pip

# Install arrow via vcpkg
Expand Down
41 changes: 22 additions & 19 deletions ci/scripts/python_wheel_windows_build.bat
Expand Up @@ -20,12 +20,10 @@
echo "Building windows wheel..."

call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
rm -rf C:\hyperarrow-build
rm -rf C:\hyperarrow\python\dist
rm -rf C:\hyperarrow\python\build
rm -rf C:\hyperarrow\python\repaired_wheels
rm -rf C:\hyperarrow\python\hyperarrow\*.dll
rm -rf C:\hyperarrow\python\hyperarrow\*.dll.*
rmdir /S /Q C:\hyperarrow-build
rmdir /S /Q C:\hyperarrow\python\dist
rmdir /S /Q C:\hyperarrow\python\build
rmdir /S /Q C:\hyperarrow\python\repaired_wheels

echo "=== (%PYTHON_VERSION%) Building HyperArrow libraries ==="
set HYPER_PATH=C:\tmp\tableau\tableauhyperapi
Expand All @@ -46,19 +44,24 @@ popd
pushd C:\hyperarrow\python

pip install delvewheel
@rem TODO - don't hard code dist name
delvewheel repair --wheel-dir repaired_wheels^
dist\hyperarrow-0.0.1.dev0-cp38-abi3-win_amd64.whl ^
cd dist
for %%a in (*.whl) do (
delvewheel repair --wheel-dir ..\repaired_wheels^
%%a ^
--add-path "C:\Program Files\arrow\bin;C:\hyperarrow-build\src\Release;C:\tmp\tableau\tableauhyperapi\bin;C:\vcpkg\packages\re2_x64-windows\bin;C:\vcpkg\packages\utf8proc_x64-windows\bin"

@rem Might be a bug but delvewheel makes hyperarrow.lib
@rem instead of hyperarrow\.lib
cd repaired_wheels
wheel unpack hyperarrow-0.0.1.dev0-cp38-abi3-win_amd64.whl
cd hyperarrow-0.0.1.dev0
cp hyperarrow.libs/* hyperarrow
rm -rf hyperarrow.libs
@rem also need to place Hyper executable herein
cp -r %HYPER_PATH%\bin\hyper hyperarrow\
wheel pack hyperarrow
@rem Might be a bug but delvewheel makes hyperarrow.lib
@rem instead of hyperarrow\.lib
cd ..\repaired_wheels
wheel unpack %%a
@REM TODO - don't hard code this path
cd hyperarrow-0.0.1.dev0
cp hyperarrow.libs/* hyperarrow
rmdir /S /Q hyperarrow.libs
@rem also need to place Hyper executable herein
cp -r %HYPER_PATH%\bin\hyper hyperarrow\
cd ..
wheel pack hyperarrow-0.0.1.dev0
rmdir /S /Q hyperarrow-0.0.1.dev0
)
popd
10 changes: 5 additions & 5 deletions docker-compose.yml
Expand Up @@ -66,11 +66,11 @@ services:
# See available versions at:
# https://quay.io/repository/pypa/manylinux2014_x86_64?tab=tags
python-wheel-manylinux-2014:
image: hyperarrow:x86_64-python-38-wheel-manylinux-2014
image: hyperarrow:x86_64-python-${PYTHON}-wheel-manylinux-2014
build:
args:
base: quay.io/pypa/manylinux2014_x86_64:2021-10-11-14ac00e
python: "3.8"
python: ${PYTHON}
manylinux: 2014
context: .
dockerfile: ci/docker/python-wheel-manylinux-201x.dockerfile
Expand All @@ -79,14 +79,14 @@ services:
command: /hyperarrow/ci/scripts/python_wheel_manylinux_build.sh

python-wheel-windows:
image: hyperarrow:python-38-wheel-windows
image: hyperarrow:python-${PYTHON}-wheel-windows
build:
args:
base: mcr.microsoft.com/windows/servercore:ltsc2019
python: "3.8"
python: ${PYTHON}
context: .
dockerfile: ci/docker/python-wheel-windows.dockerfile
volumes:
- .:c:\hyperarrow
cpu_count: 8
command: hyperarrow\\ci\\scripts\\python_wheel_windows_build.bat
command: hyperarrow\\ci\\scripts\\python_wheel_windows_build.bat
1 change: 0 additions & 1 deletion python/hyperarrow/hyperarrow.cpp
@@ -1,4 +1,3 @@
#define Py_LIMITED_API 0x03080000
#define PY_SSIZE_T_CLEAN
#include <Python.h>

Expand Down
1 change: 0 additions & 1 deletion python/setup.py
Expand Up @@ -58,7 +58,6 @@
sources=list(glob("hyperarrow/hyperarrow.cpp")),
extra_compile_args=extra_compile_args,
language="c++",
py_limited_api=True,
)

setup(
Expand Down

0 comments on commit 90b1a46

Please sign in to comment.