diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 8c7748fa..9745a98a 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -32,9 +32,6 @@ jobs: uses: supercharge/mongodb-github-action@1.9.0 with: mongodb-version: 6.0 - - name: Install libbson - run: | - LIBBSON_INSTALL_DIR=$(pwd)/libbson ./build-libbson.sh - name: Install Python dependencies run: | python -m pip install -U pip @@ -60,14 +57,15 @@ jobs: # the current target that this PR will be merged into is HEAD^1. git update-ref refs/bm/merge-target $(git log -n 1 --pretty=format:"%H" main --) git checkout --force refs/bm/pr -- - # Install the library - LIBBSON_INSTALL_DIR=$(pwd)/libbson python -m pip install -e ".[test]" + # Build and install the manylinux wheel + bash ./build-manylinux-wheel.sh + pip install dist/*.whl run_asv - git checkout --force refs/bm/merge-target -- - # Install the library - LIBBSON_INSTALL_DIR=$(pwd)/libbson python -m pip install -e ".[test]" + # Build and install the manylinux wheel + bash ./build-manylinux-wheel.sh + pip install dist/*.whl run_asv - name: Compare benchmarks diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml index 320c1c31..53eb4377 100644 --- a/.github/workflows/release-python.yml +++ b/.github/workflows/release-python.yml @@ -87,7 +87,7 @@ jobs: make_sdist: name: Make SDist - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 845f95b5..8eccc385 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -28,11 +28,10 @@ jobs: extra_args: --all-files --hook-stage=manual build: - # supercharge/mongodb-github-action requires containers so we don't test other platforms runs-on: ${{ matrix.os }} strategy: matrix: - os: ["ubuntu-20.04", "macos-latest", "windows-latest"] + os: ["macos-latest", "windows-latest"] python-version: [3.8, 3.9, "3.10", "3.11"] fail-fast: false name: CPython ${{ matrix.python-version }}-${{ matrix.os }} @@ -49,12 +48,6 @@ jobs: run: | echo "LIBBSON_INSTALL_DIR=$PWD/libbson" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=$PWD/libbson/lib" >> $GITHUB_ENV - - name: Start MongoDB on Linux - if: ${{ startsWith(runner.os, 'Linux') }} - uses: supercharge/mongodb-github-action@1.3.0 - with: - mongodb-version: 4.4 - mongodb-replica-set: test-rs - name: Start MongoDB on MacOS if: ${{ startsWith(runner.os, 'macOS') }} run: | @@ -89,13 +82,38 @@ jobs: - name: Run the tests run: | python -m pytest -v + + build-linux: + runs-on: ubuntu-latest + name: CPython Ubuntu + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + cache: 'pip' + cache-dependency-path: 'bindings/python/pyproject.toml' + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.3.0 + with: + mongodb-version: 4.4 + mongodb-replica-set: test-rs + - name: Build and install package and test deps + run: | + bash build-manylinux-wheel.sh + pip install dist/*.whl + pip install pytz pytest + - name: Run the tests + run: | + python -m pytest -v - name: Check the manifest run: | pip install check-manifest check-manifest -v docs: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v3 - name: Cache conda diff --git a/bindings/python/build-manylinux-wheel-internal.sh b/bindings/python/build-manylinux-wheel-internal.sh new file mode 100755 index 00000000..118480a8 --- /dev/null +++ b/bindings/python/build-manylinux-wheel-internal.sh @@ -0,0 +1,11 @@ +#!/bin/bash -ex +cd /src +LIBBSON_INSTALL_DIR=$(pwd)/libbson +rm -rf $LIBBSON_INSTALL_DIR +./build-libbson.sh +rm -rf build dist +PYTHON=/opt/python/cp311-cp311/bin/python +$PYTHON -m pip install build +$PYTHON -m build --wheel . +rm -rf $LIBBSON_INSTALL_DIR +rm -rf build diff --git a/bindings/python/build-manylinux-wheel.sh b/bindings/python/build-manylinux-wheel.sh new file mode 100755 index 00000000..c2dc8167 --- /dev/null +++ b/bindings/python/build-manylinux-wheel.sh @@ -0,0 +1,8 @@ +#!/bin/bash -ex + +set -o xtrace +set -o errexit + +image="quay.io/pypa/manylinux2014_x86_64" +docker pull $image +docker run --rm -v "`pwd`:/src" $image /src/build-manylinux-wheel-internal.sh diff --git a/bindings/python/docs/source/developer/installation.rst b/bindings/python/docs/source/developer/installation.rst index a6125132..5da062bc 100644 --- a/bindings/python/docs/source/developer/installation.rst +++ b/bindings/python/docs/source/developer/installation.rst @@ -12,9 +12,10 @@ Command Line Tools. Additionally, you need CMake and pkg-config:: $ brew install cmake $ brew install pkg-config -On Linux, you require gcc 4.8, CMake and pkg-config. +On Linux, you will need docker, to run the "build-manylinux-wheel.sh" script. -Windows is not yet supported. +On Windows, you will need Visual Studio 2017 or later, with the Python Development +workload installed. Environment Setup ----------------- @@ -37,7 +38,6 @@ PyMongoArrow uses `libbson `_. Detailed instructions for building/installing ``libbson`` can be found `here `_. - You can either use a system-provided version of ``libbson`` that is properly configured for use with ``pkg-config``, or use the provided ``build-libbson.sh`` script to build it:: @@ -65,6 +65,8 @@ If you built libbson using the `build-libbson` script then use the same `LIBBSON (pymongoarrow) $ LIBBSON_INSTALL_DIR=$(pwd)/libbson pip install -v -e ".[test]" +Note: we do not support editable installs on Linux, the "build-manylinux-wheel.sh" script must be used +to create the wheel. Test ----