From 89e042c44fc0a6fe41ad4d1e661150d608914777 Mon Sep 17 00:00:00 2001 From: Joris Vankerschaver Date: Thu, 12 Aug 2021 17:23:49 +0900 Subject: [PATCH 1/9] DEV: Build wheels using cibuildwheel. --- .gitignore | 1 + README.md | 14 ++++++++++++++ ci/build-parasail.sh | 17 +++++++++++++++++ pyproject.toml | 7 +++++++ 4 files changed, 39 insertions(+) create mode 100755 ci/build-parasail.sh create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore index 782f661..d2c5e41 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +wheelhouse/ build/ vpsearch.egg-info/ vpsearch/_vpsearch.cpp diff --git a/README.md b/README.md index a7e8011..237bfd9 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,20 @@ represents the linearized tree can only query the database, not build the tree. The slower tree-of-nodes implementation can build and query (albeit with more overhead). +## Building wheels + +Wheels for this package can be built in a platform-independent way using +[cibuildwheel](https://cibuildwheel.readthedocs.io/en/stable/). In a clean +Python environment, run `pip install cibuildwheel` to install the tool, +followed by e.g. +```bash + CIBW_BUILD=cp38-manylinux_x86_64 \ + CIBW_BEFORE_BUILD="./ci/build-parasail.sh" \ + python -m cibuildwheel --output-dir wheelhouse --platform linux +``` +to build Python 3.8 wheels for Linux. By varying the build tag, wheels for +other Python versions can be built. + ## License This package is licensed under the [BSD license](LICENSE.txt). diff --git a/ci/build-parasail.sh b/ci/build-parasail.sh new file mode 100755 index 0000000..5c21c5b --- /dev/null +++ b/ci/build-parasail.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# +# Download a fixed version of Parasail, compile it, and install to /usr/local. +# Mainly used to build Linux wheels, inside an appropriate manylinux container. + +set -euxo pipefail + +PARASAIL_VERSION="2.4.3" +PARASAIL_URL="https://github.com/jeffdaily/parasail/releases/download/v${PARASAIL_VERSION}/parasail-${PARASAIL_VERSION}.tar.gz" + +# Download +curl -L "${PARASAIL_URL}" -o - | tar xzf - + +# Build +cd "parasail-${PARASAIL_VERSION}" +autoreconf -fi +./configure --prefix "/usr/local" && make -j4 && make install diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..cc8f0a5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,7 @@ +[build-system] +requires = [ + "setuptools", + "wheel", + "Cython>=0.28.5", + "oldest-supported-numpy", # https://github.com/scipy/oldest-supported-numpy +] From b4c98957b6908b820a373ee3ef9078c0d9ccf0ef Mon Sep 17 00:00:00 2001 From: Joris Vankerschaver Date: Fri, 13 Aug 2021 08:36:46 +0900 Subject: [PATCH 2/9] DOC: Add verbose flag. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 237bfd9..878dc44 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,7 @@ Wheels for this package can be built in a platform-independent way using Python environment, run `pip install cibuildwheel` to install the tool, followed by e.g. ```bash + CIBW_BUILD_VERBOSITY=1 \ CIBW_BUILD=cp38-manylinux_x86_64 \ CIBW_BEFORE_BUILD="./ci/build-parasail.sh" \ python -m cibuildwheel --output-dir wheelhouse --platform linux From f49d005358704e53a195b763fa32d92e265072ab Mon Sep 17 00:00:00 2001 From: Joris Vankerschaver Date: Thu, 7 Oct 2021 09:04:53 +0900 Subject: [PATCH 3/9] DEV: Build wheels using GH actions --- .github/workflows/build-wheels.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/build-wheels.yml diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml new file mode 100644 index 0000000..5d7dd5d --- /dev/null +++ b/.github/workflows/build-wheels.yml @@ -0,0 +1,28 @@ +name: Build wheels + +on: + release + +jobs: + buildwheels: + strategy: + matrix: + os: [ubuntu-latest] + python-version: [3.6] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - name: install cibuildwheel + run: python -m pip install cibuildwheel==2.2.0a1 + - name: Build wheels + run: python -m cibuildwheel --output-dir wheelhouse + # to supply options, put them in 'env', like: + env: + CIBW_BUILD_VERBOSITY=1 + CIBW_BEFORE_BUILD="./ci/build-parasail.sh" + - uses: actions/upload-artifact@v2 + with: + path: ./wheelhouse/*.whl \ No newline at end of file From 7d0290ee79a0e7284ea8bc8234873442a4701d11 Mon Sep 17 00:00:00 2001 From: Joris Vankerschaver Date: Fri, 8 Oct 2021 22:25:19 +0900 Subject: [PATCH 4/9] DEV: Workflog to build wheels on GH actions --- .github/workflows/build-wheels.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 5d7dd5d..acd2052 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -1,28 +1,31 @@ name: Build wheels on: - release + workflow_dispatch jobs: buildwheels: strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, macos-latest] python-version: [3.6] runs-on: ${{ matrix.os }} steps: + - name: install automake + run: brew install automake + if: matrix.os == 'macOS-latest' - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - name: install cibuildwheel - run: python -m pip install cibuildwheel==2.2.0a1 + run: python -m pip install cibuildwheel==2.2.0a1 - name: Build wheels - run: python -m cibuildwheel --output-dir wheelhouse - # to supply options, put them in 'env', like: - env: - CIBW_BUILD_VERBOSITY=1 - CIBW_BEFORE_BUILD="./ci/build-parasail.sh" + run: python -m cibuildwheel --output-dir wheelhouse + env: + CIBW_BUILD_VERBOSITY: 1 + CIBW_BEFORE_BUILD: "./ci/build-parasail.sh" + CIBW_SKIP: "cp36-* cp310-macosx_* pp3*" - uses: actions/upload-artifact@v2 - with: - path: ./wheelhouse/*.whl \ No newline at end of file + with: + path: ./wheelhouse/*.whl From acccc02c3563874fdaeea90a505c871d49a03a85 Mon Sep 17 00:00:00 2001 From: Joris Vankerschaver Date: Mon, 11 Oct 2021 10:40:50 +0900 Subject: [PATCH 5/9] DOC: Describe wheels workflow --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 878dc44..13a6fb5 100644 --- a/README.md +++ b/README.md @@ -165,9 +165,15 @@ overhead). ## Building wheels Wheels for this package can be built in a platform-independent way using -[cibuildwheel](https://cibuildwheel.readthedocs.io/en/stable/). In a clean -Python environment, run `pip install cibuildwheel` to install the tool, -followed by e.g. +[cibuildwheel](https://cibuildwheel.readthedocs.io/en/stable/), running under +GitHub actions. As an administrator, you can start a workflow to build wheels +by selecting the "Build wheels" action from the GitHub actions menu, and +clicking the "Run workflow" button. When the workflow completes, wheels for +Linux and macOS will be available as a zipped artifact. + +It is possible to run cibuildwheels locally, but only to build wheels for +Linux. In a clean Python environment, run `pip install cibuildwheel` to install +the tool, followed by e.g. ```bash CIBW_BUILD_VERBOSITY=1 \ CIBW_BUILD=cp38-manylinux_x86_64 \ From cea43cc1b13462241ef69770be3fdf20039a9a02 Mon Sep 17 00:00:00 2001 From: Joris Vankerschaver Date: Tue, 12 Oct 2021 20:59:09 +0900 Subject: [PATCH 6/9] DEV: Use released version of cibuildwheel. --- .github/workflows/build-wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index acd2052..fd94a98 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - name: install cibuildwheel - run: python -m pip install cibuildwheel==2.2.0a1 + run: python -m pip install cibuildwheel==2.1.3 - name: Build wheels run: python -m cibuildwheel --output-dir wheelhouse env: From 1eaa3656bb08f094c174d2b4f416b1f13b0d3132 Mon Sep 17 00:00:00 2001 From: Joris Vankerschaver Date: Tue, 12 Oct 2021 20:59:35 +0900 Subject: [PATCH 7/9] DEV: Enable building wheels for Python 3.6 --- .github/workflows/build-wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index fd94a98..2c4df95 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -25,7 +25,7 @@ jobs: env: CIBW_BUILD_VERBOSITY: 1 CIBW_BEFORE_BUILD: "./ci/build-parasail.sh" - CIBW_SKIP: "cp36-* cp310-macosx_* pp3*" + CIBW_SKIP: "cp310-macosx_* pp3*" - uses: actions/upload-artifact@v2 with: path: ./wheelhouse/*.whl From 3b365c5e5304b1740555d0e76e7a1288832984a7 Mon Sep 17 00:00:00 2001 From: Joris Vankerschaver Date: Tue, 12 Oct 2021 21:05:42 +0900 Subject: [PATCH 8/9] STY: Lowercase matrix.os name Co-authored-by: Mark Dickinson --- .github/workflows/build-wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 2c4df95..e510a7d 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -15,7 +15,7 @@ jobs: steps: - name: install automake run: brew install automake - if: matrix.os == 'macOS-latest' + if: matrix.os == 'macos-latest' - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - name: install cibuildwheel From 8d857005e84b7db2ae3fd6af5d43b936173266f2 Mon Sep 17 00:00:00 2001 From: Joris Vankerschaver Date: Tue, 12 Oct 2021 21:06:05 +0900 Subject: [PATCH 9/9] MAINT: Properly quote version numbers Co-authored-by: Mark Dickinson --- .github/workflows/build-wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index e510a7d..1d8e071 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - python-version: [3.6] + python-version: ['3.6'] runs-on: ${{ matrix.os }}