Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 4.3k
GH-41910: [Python] Add support for Pyodide#37822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
eda86ae1fe184575797491bda7a9ef1ce8e7166f46a6e78f561d95adbef91cb7b806c45812a836c615001f137cee3f9938bdce1421222a6963c13b1ceee306501d96fc3c478d65c2e24a8d785fe5322d50da860dd21f71e2549fc48a6cbfad6897b762153f8735b9a62fc018e01524fc171ab8ab9b4ea2c24763a304b8afd2d223f217cfb19bddb870c7891fc9512707ad3afde0b7611f8929cbce56f74af98b1115643d3c257d37cd05e21f8f4a9de8f816291bf1af0508efbeeeaa78895e71815cc1978f0ead4cb64ebca5029bb2d699f466c4466d727ac5d49090f333b409ea377f4dec465fb16fb6ef6a1dcf165d40c7f92de98c7e128bf07a0f6960975faa05baba64d72a319ccdcf8cda53f070a7a355114bf7ecc28fee6307ac89560ae61d50891801210f928e30ade27da99533c08fa80562269c029e739d042c43b4bd02bf480cabebbe3a9e71079591b01e00a740fe9444c2174896872b4ded135ecf65fef3a9035477d0ea70e5df20ddc0c24203d3a7a5944c714eaf8b70c98845246cd1de66a6472a783b807ead3b081a19b3661cb95555d3473f214e396f77c696d92807f803100a51befcef4c72de2d8d7346e179a9d34218077d91c26d3a792909cedb44d2f13c6a9ecdf2c0f4c7f5eb30b304c7c2e5b65daa020061dcd99321f96bfa0e49771a2f6aFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
joemarshall marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # 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. | ||
| ARG repo | ||
| ARG arch | ||
| ARG python="3.12" | ||
| FROM ${repo}:${arch}-conda-python-${python} | ||
| ARG selenium_version="4.15.2" | ||
| ARG pyodide_version="0.26.0" | ||
| ARG chrome_version="latest" | ||
| ARG required_python_min="(3,12)" | ||
| # fail if python version < 3.12 | ||
| RUN echo "check PYTHON>=${required_python_min}" && python -c "import sys;sys.exit(0 if sys.version_info>=${required_python_min} else 1)" | ||
| # install selenium and pyodide-build and recent python | ||
| # needs to be a login shell so ~/.profile is read | ||
| SHELL ["/bin/bash", "--login", "-c", "-o", "pipefail"] | ||
| RUN python -m pip install --no-cache-dir selenium==${selenium_version} && \ | ||
| python -m pip install --no-cache-dir --upgrade pyodide-build==${pyodide_version} | ||
| # install pyodide dist directory to /pyodide | ||
| RUN pyodide_dist_url="https://github.com/pyodide/pyodide/releases/download/${pyodide_version}/pyodide-${pyodide_version}.tar.bz2" && \ | ||
| wget -q "${pyodide_dist_url}" -O- | tar -xj -C / | ||
| # install correct version of emscripten for this pyodide | ||
| COPY ci/scripts/install_emscripten.sh /arrow/ci/scripts/ | ||
| RUN bash /arrow/ci/scripts/install_emscripten.sh ~ /pyodide | ||
| # make sure zlib is cached in the EMSDK folder | ||
| RUN source ~/emsdk/emsdk_env.sh && embuilder --pic build zlib | ||
| # install node 20 (needed for async call support) | ||
| # and pthread-stubs for build, and unzip needed for chrome build to work | ||
| RUN conda install nodejs=20 unzip pthread-stubs make -c conda-forge | ||
joemarshall marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # install chrome for testing browser based runner | ||
| COPY ci/scripts/install_chromedriver.sh /arrow/ci/scripts/ | ||
| RUN /arrow/ci/scripts/install_chromedriver.sh "${chrome_version}" | ||
joemarshall marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # make the version of make that is installed by conda be available everywhere | ||
| # or else pyodide's isolated build fails to find it | ||
| RUN ln -s "$(type -P make)" /bin/make | ||
| ENV ARROW_BUILD_TESTS="OFF" \ | ||
| ARROW_BUILD_TYPE="release" \ | ||
| ARROW_DEPENDENCY_SOURCE="BUNDLED" \ | ||
| ARROW_EMSCRIPTEN="ON" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # 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. | ||
| # Install Chrome and Chromedriver for Selenium | ||
| set -e | ||
| chrome_version=$1 | ||
| if [ $chrome_version = "latest" ]; then | ||
| latest_release_path=LATEST_RELEASE_STABLE | ||
| else | ||
| latest_release_path=LATEST_RELEASE_${chrome_version} | ||
| fi | ||
| CHROME_VERSION_FULL=$(wget -q --no-verbose -O - "https://googlechromelabs.github.io/chrome-for-testing/${latest_release_path}") | ||
| CHROME_DOWNLOAD_URL="https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION_FULL}-1_amd64.deb" | ||
| CHROMEDRIVER_DOWNLOAD_URL="https://storage.googleapis.com/chrome-for-testing-public/${CHROME_VERSION_FULL}/linux64/chromedriver-linux64.zip" | ||
| wget -q --no-verbose -O /tmp/google-chrome.deb "${CHROME_DOWNLOAD_URL}" | ||
| apt-get update | ||
| apt install -qqy /tmp/google-chrome.deb | ||
| rm -f /tmp/google-chrome.deb | ||
| rm -rf /var/lib/apt/lists/* | ||
| wget --no-verbose -O /tmp/chromedriver-linux64.zip "${CHROMEDRIVER_DOWNLOAD_URL}" | ||
| unzip /tmp/chromedriver-linux64.zip -d /opt/ | ||
| rm /tmp/chromedriver-linux64.zip | ||
| ln -fs /opt/chromedriver-linux64/chromedriver /usr/local/bin/chromedriver | ||
| echo "Using Chrome version: $(google-chrome --version)" | ||
| echo "Using Chrome Driver version: $(chromedriver --version)" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # 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. | ||
| # install emscripten sdk version to match pyodide in $2 to directory $1/emsdk | ||
| set -e | ||
| target_path=$1 | ||
| pyodide_path=$2 | ||
| emscripten_version=$(${pyodide_path}/python -c "import sys;print(*sys._emscripten_info.emscripten_version,sep='.')") | ||
| cd ${target_path} | ||
| if [ ! -d emsdk ]; then | ||
| git clone https://github.com/emscripten-core/emsdk.git | ||
| fi | ||
| cd emsdk | ||
| ./emsdk install ${emscripten_version} | ||
| ./emsdk activate ${emscripten_version} | ||
| echo "Installed emsdk to: ${target_path}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # 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. | ||
| set -ex | ||
| arrow_dir=${1} | ||
| build_dir=${2} | ||
| source ~/emsdk/emsdk_env.sh | ||
| source_dir=${arrow_dir}/python | ||
| python_build_dir=${build_dir}/python | ||
| rm -rf ${python_build_dir} | ||
| cp -aL ${source_dir} ${python_build_dir} | ||
| # conda sets LDFLAGS / CFLAGS etc. which break | ||
| # emcmake so we unset them | ||
| unset LDFLAGS CFLAGS CXXFLAGS CPPFLAGS | ||
| pushd ${python_build_dir} | ||
| pyodide build | ||
| popd |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # 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. | ||
| # run tests against Chrome and node.js as representative | ||
| # WebAssembly platforms (i.e. one browser, one non-browser). | ||
| set -ex | ||
| build_dir=${1}/python | ||
| pyodide_dist_dir=${2} | ||
| cd ${build_dir} | ||
| # note: this uses the newest wheel in dist | ||
| pyodide_wheel=$(ls -t dist/pyarrow*.whl | head -1) | ||
| echo "-------------- Running emscripten tests in Node ----------------------" | ||
| python scripts/run_emscripten_tests.py ${pyodide_wheel} --dist-dir=${pyodide_dist_dir} --runtime=node | ||
| echo "-------------- Running emscripten tests in Chrome --------------------" | ||
| python scripts/run_emscripten_tests.py ${pyodide_wheel} --dist-dir=${pyodide_dist_dir} --runtime=chrome | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.