Skip to content

Commit 950a578

Browse files
authored
Substrait bindings (apache#145)
* introduce bindings for substrait and new substrait module * documention for the substrait module including examples * add pytest for substrait * cargo fmt * Add action for setting up build environment and also install protobuf compiler * pin to a specific revision instead of master * pin to specific version, wrong version last time * Remove --locked since building from github revisions * add lock file * adjust path to include protoc * set PROTOC evn variable * change permissions of directory containing protobuf compiler since permissions error was encountered * Try permissions again * Try permissions again * Try permissions again * Try permissions again * Try permissions again * Alter permissions * Alter permissions * Alter permissions
1 parent e6a4d4d commit 950a578

13 files changed

Lines changed: 902 additions & 102 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Prepare Rust Builder
19+
description: 'Prepare Rust Build Environment'
20+
inputs:
21+
rust-version:
22+
description: 'version of rust to install (e.g. stable)'
23+
required: true
24+
default: 'stable'
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: Install Build Dependencies
29+
shell: bash
30+
run: |
31+
apt-get update
32+
apt-get install -y protobuf-compiler
33+
- name: Setup Rust toolchain
34+
shell: bash
35+
run: |
36+
echo "Installing ${{ inputs.rust-version }}"
37+
rustup toolchain install ${{ inputs.rust-version }}
38+
rustup default ${{ inputs.rust-version }}
39+
rustup component add rustfmt

‎.github/workflows/build.yml‎

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ jobs:
6060
with:
6161
toolchain: stable
6262

63-
- name: Install dependencies
64-
run: |
65-
python -m pip install --upgrade pip
66-
pip install maturin==0.14.2
67-
6863
- run: rm LICENSE.txt
6964
- name: Download LICENSE.txt
7065
uses: actions/download-artifact@v3
@@ -73,7 +68,7 @@ jobs:
7368
path: .
7469

7570
- name: Build Python package
76-
run: maturin build --release --strip --locked
71+
run: maturin build --release --strip
7772

7873
- name: List Windows wheels
7974
if: matrix.os == 'windows-latest'
@@ -103,12 +98,12 @@ jobs:
10398
path: .
10499
- run: cat LICENSE.txt
105100
- name: Build wheels
106-
run: |
107-
export RUSTFLAGS='-C target-cpu=skylake'
108-
docker run --rm -v $(pwd):/io \
109-
--workdir /io \
110-
ghcr.io/pyo3/maturin:v0.14.2 \
111-
build --release --manylinux 2014 --locked
101+
uses: PyO3/maturin-action@v1
102+
with:
103+
rust-toolchain: nightly
104+
target: x86_64
105+
manylinux: auto
106+
args: --release --manylinux 2014
112107
- name: Archive wheels
113108
uses: actions/upload-artifact@v3
114109
with:
@@ -129,12 +124,11 @@ jobs:
129124
path: .
130125
- run: cat LICENSE.txt
131126
- name: Build sdist
132-
run: |
133-
docker run --rm -v $(pwd):/io \
134-
--workdir /io \
135-
ghcr.io/pyo3/maturin:v0.14.2 \
136-
build --release --sdist --locked
137-
find target/wheels/
127+
uses: PyO3/maturin-action@v1
128+
with:
129+
rust-toolchain: stable
130+
manylinux: auto
131+
args: --release --sdist --out dist
138132
- name: Archive wheels
139133
uses: actions/upload-artifact@v2
140134
with:

‎.github/workflows/test.yaml‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@ jobs:
5353
toolchain: ${{ matrix.toolchain }}
5454
override: true
5555

56+
- name: Install protobuf compiler
57+
shell: bash
58+
run: |
59+
mkdir -p $HOME/d/protoc
60+
cd $HOME/d/protoc
61+
export PROTO_ZIP="protoc-21.4-linux-x86_64.zip"
62+
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.4/$PROTO_ZIP
63+
unzip $PROTO_ZIP
64+
export PATH=$PATH:$HOME/d/protoc/bin
65+
export PROTOC=$HOME/d/protoc/bin
66+
sudo chown -R $(whoami) $HOME/d/protoc
67+
protoc --version
68+
5669
- name: Setup Python
5770
uses: actions/setup-python@v4
5871
with:
@@ -99,9 +112,22 @@ jobs:
99112
flake8 --exclude venv --ignore=E501,W503
100113
black --line-length 79 --diff --check .
101114
115+
- name: Build wheels
116+
uses: PyO3/maturin-action@v1
117+
with:
118+
command: build
119+
args: --release --out dist
120+
102121
- name: Run tests
103122
run: |
104123
git submodule update --init
105-
source venv/bin/activate
106-
maturin develop --locked
124+
export PATH=$PATH:$HOME/d/protoc/bin
125+
export PROTOC=$HOME/d/protoc/bin
126+
sudo chown -R $(whoami) $HOME/d/protoc
127+
ls -l $HOME/d/protoc/
128+
ls -l $HOME/d/protoc/bin
129+
pip install datafusion-python --no-index --find-links dist --force-reinstall
130+
pip install pytest
131+
cargo clean
132+
maturin develop
107133
RUST_BACKTRACE=1 pytest -v .

0 commit comments

Comments
 (0)