Skip to content
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

docs: move to newest pyodide toolchain #2062

Merged
merged 22 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 73 additions & 11 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,65 @@ concurrency:
cancel-in-progress: true

env:
PYTHON_VERSION: "3.10.6"
X86_64_PYTHON_VERSION: "3.10.6"
SOURCE_DATE_EPOCH: "1668811211"

jobs:
pyodide-python-version:
name: Determine Pyodide Python version
runs-on: ubuntu-22.04
outputs:
python-version: ${{ steps.retrieve-python-version.outputs.python-version }}
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Cache python version
id: cache-pyodide-python-version
uses: actions/cache@v3
with:
path: pyodide-python-version
key: ${{ runner.os }}-docs-pyodide-python-version-${{ hashFiles('docs/requirements-wasm.txt') }}

- name: Setup Python
if: steps.cache-pyodide-python-version.outputs.cache-hit != 'true'
uses: actions/setup-python@v4
with:
python-version: "${{ env.X86_64_PYTHON_VERSION }}"

- name: Install dependencies
if: steps.cache-pyodide-python-version.outputs.cache-hit != 'true'
run: python3 -m pip install -r docs/requirements-wasm.txt

- name: Determine Python version
if: steps.cache-pyodide-python-version.outputs.cache-hit != 'true'
id: compute-python-version
run: |
# Save Python version
PYTHON_VERSION=$(pyodide config get python_version)
echo $PYTHON_VERSION > pyodide-python-version

- name: Retrieve Python version
id: retrieve-python-version
run: |
PYTHON_VERSION=$(cat pyodide-python-version)
echo "python-version=$PYTHON_VERSION" >> "$GITHUB_OUTPUT"

awkward-cpp-wasm:
name: Build C++ WASM
runs-on: ubuntu-22.04
needs: [pyodide-python-version]
steps:
- uses: actions/checkout@v3
with:
submodules: true


- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "${{ env.PYTHON_VERSION }}"
python-version: "${{ needs.pyodide-python-version.outputs.python-version }}"

- name: Generate build files
run: pipx run nox -s prepare -- --headers --signatures
Expand All @@ -38,21 +81,35 @@ jobs:
uses: actions/cache@v3
with:
path: ./awkward-cpp/dist
key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-awkward-cpp-wasm-${{ hashFiles('awkward-cpp/**') }}
key: ${{ runner.os }}-"${{ needs.pyodide-python-version.outputs.python-version }}-awkward-cpp-wasm-${{ hashFiles('awkward-cpp/**') }}

- name: Install dependencies
if: steps.cache-awkward-cpp-wasm-wheel.outputs.cache-hit != 'true'
run: python3 -m pip install -r docs/requirements-wasm.txt

- name: Determine EMSDK version
if: steps.cache-awkward-cpp-wasm-wheel.outputs.cache-hit != 'true'
id: compute-emsdk-version
run: |
# Prepare xbuild environment (side-effect)
pyodide config list
# Save EMSDK version
EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version)
echo "emsdk-version=$EMSCRIPTEN_VERSION" >> $GITHUB_OUTPUT
working-directory: awkward-cpp

- name: Install EMSDK
uses: mymindstorm/setup-emsdk@v12
if: steps.cache-awkward-cpp-wasm-wheel.outputs.cache-hit != 'true'
with:
version: 3.1.14
version: ${{ steps.compute-emsdk-version.outputs.emsdk-version }}

- name: Build wheel
if: steps.cache-awkward-cpp-wasm-wheel.outputs.cache-hit != 'true'
id: build-awkward-cpp-wasm-wheel
run: |
# pyodide-build doesn't work out of the box with pipx
python3 -m pip install pyyaml pyodide-build==0.21.0
export CMAKE_ARGS="-DEMSCRIPTEN=1"
pyodide build --exports whole_archive
CMAKE_ARGS="-DEMSCRIPTEN=1 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH" pyodide build --exports whole_archive
working-directory: awkward-cpp

- name: Upload wheel
Expand All @@ -64,6 +121,10 @@ jobs:
awkward-cpp-x86-64:
runs-on: ubuntu-22.04
name: Build C++ x86
defaults:
run:
# Ensure conda env is activated
shell: "bash -l {0}"
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -88,8 +149,9 @@ jobs:
cache-downloads: true
environment-file: docs/environment.yml
create-args: >-
python=${{ env.PYTHON_VERSION }}
python=${{ env.X86_64_PYTHON_VERSION }}
doxygen
python-build

- name: Generate build files
run: pipx run nox -s prepare -- --headers --signatures
Expand All @@ -99,11 +161,11 @@ jobs:
uses: actions/cache@v3
with:
path: ./awkward-cpp/dist
key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-awkward-x86-64-wasm-${{ hashFiles('awkward-cpp/**') }}
key: ${{ runner.os }}-${{ env.X86_64_PYTHON_VERSION }}-awkward-x86-64-wasm-${{ hashFiles('awkward-cpp/**') }}

- name: Build wheel
if: steps.cache-awkward-cpp-x86-64-wheel.outputs.cache-hit != 'true'
run: pipx run build -w ./awkward-cpp
run: python -m build -w ./awkward-cpp

- name: Upload wheel
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -164,7 +226,7 @@ jobs:
cache-downloads: true
environment-file: docs/environment.yml
create-args: >-
python=${{ env.PYTHON_VERSION }}
python=${{ env.X86_64_PYTHON_VERSION }}
doxygen

- name: Download awkward wheel
Expand Down
6 changes: 6 additions & 0 deletions awkward-cpp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,9 @@ sdist.include = [
"tests-spec-explicit",
"tests-cpu-kernels"
]

# This activates verbose builds
cmake.verbose = true

# Display logs at or above this level.
logging.level = "DEBUG"
1 change: 1 addition & 0 deletions docs/requirements-wasm.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyodide-build==0.23.3
9 changes: 6 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# JupyterLite (kernel requires specific pyodide version)
jupyterlite-pyodide-kernel==0.0.8
jupyterlite[piplite]==0.1.0
jupyterlite-sphinx==0.8.0

sphinx>=4.5.0,<5.0.0
PyYAML
black
Expand All @@ -9,12 +14,10 @@ sphinx-sitemap
pydata-sphinx-theme
myst-nb
sphinx-external-toc
jupyterlite-sphinx==0.7.3
ipyleaflet
jupyterlite[piplite]==0.1.0b16

numpy>=1.13.1
numba>=0.50.0
numba>=0.50.0;python_version<"3.11"
pandas>=0.24.0
numexpr
pyarrow>=7.0.0
Expand Down