Skip to content

Commit ac57b56

Browse files
committed
Python Wheel: initial commit
1 parent 5782347 commit ac57b56

File tree

6 files changed

+137
-2
lines changed

6 files changed

+137
-2
lines changed
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# (C) Copyright 2025- ECMWF.
2+
#
3+
# This software is licensed under the terms of the Apache Licence Version 2.0
4+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5+
# In applying this licence, ECMWF does not waive the privileges and immunities
6+
# granted to it by virtue of its status as an intergovernmental organisation
7+
# nor does it submit to any jurisdiction.
8+
9+
10+
name: Build Python Wheel for Linux
11+
12+
on:
13+
# Trigger the workflow manually
14+
workflow_dispatch: ~
15+
16+
# Allow to be called from another workflow
17+
workflow_call: ~
18+
19+
# TODO automation trigger
20+
21+
jobs:
22+
build:
23+
name: Build manylinux_2_28
24+
runs-on: [self-hosted, Linux, platform-builder-Rocky-8.6]
25+
# TODO which manylinux do we want to build for? 2014? 2_28? 2_34? Matrix?
26+
container:
27+
image: eccr.ecmwf.int/wheelmaker/2_28:latest
28+
credentials:
29+
username: ${{ secrets.ECMWF_DOCKER_REGISTRY_USERNAME }}
30+
password: ${{ secrets.ECMWF_DOCKER_REGISTRY_ACCESS_TOKEN }}
31+
steps:
32+
# TODO convert this to be matrix-friendly. Note it's a bit tricky since
33+
# we'd ideally not reexecute the compile step multiple times, but it
34+
# (non-essentially) depends on a matrix-based step
35+
# NOTE we dont use action checkout because it doesnt cleanup after itself correctly
36+
- run: git clone --depth=1 --branch="${GITHUB_REF#refs/heads/}" https://github.com/$GITHUB_REPOSITORY /proj
37+
- run: cd /proj && /buildscripts/prepare_deps.sh ./python_wrapper/buildconfig 3.11
38+
- run: cd /proj && /buildscripts/compile.sh ./python_wrapper/buildconfig
39+
- run: cd /proj && PYTHONPATH=/buildscripts /buildscripts/wheel-linux.sh ./python_wrapper/buildconfig 3.11
40+
- run: cd /proj && /buildscripts/test-wheel.sh ./python_wrapper/buildconfig 3.11
41+
- run: cd /proj && /buildscripts/upload-pypi.sh ./python_wrapper/buildconfig
42+
env:
43+
TWINE_USERNAME: __token__
44+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
45+
# NOTE temporary thing until all the mess gets cleared
46+
- run: rm -rf ./* ./.git ./.github
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# (C) Copyright 2024- ECMWF.
2+
#
3+
# This software is licensed under the terms of the Apache Licence Version 2.0
4+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5+
# In applying this licence, ECMWF does not waive the privileges and immunities
6+
# granted to it by virtue of its status as an intergovernmental organisation
7+
# nor does it submit to any jurisdiction.
8+
9+
10+
name: Build Python Wheel for MacOS
11+
12+
on:
13+
# Trigger the workflow manually
14+
workflow_dispatch: ~
15+
16+
# Allow to be called from another workflow
17+
workflow_call: ~
18+
19+
# TODO automation trigger
20+
21+
jobs:
22+
build:
23+
name: Build macos wheel
24+
# TODO enable after all tested
25+
# strategy:
26+
# matrix:
27+
# arch_type: [ARM64, X64]
28+
# runs-on: [self-hosted, macOS, "${{ matrix.arch_type }}"]
29+
runs-on: [self-hosted, macOS, ARM64 ]
30+
steps:
31+
# TODO convert this to be matrix-friendly for python versions. Note it's a bit tricky since
32+
# we'd ideally not reexecute the compile step multiple times, but it
33+
# (non-essentially) depends on a matrix-based step
34+
# NOTE we dont use action checkout because it doesnt cleanup after itself correctly
35+
- run: |
36+
if [ -z "$(which uv)" ] ; then curl -LsSf https://astral.sh/uv/install.sh | sh ; fi
37+
rm -rf ecbuild wheelmaker
38+
git clone --depth=1 https://github.com/ecmwf/ecbuild ecbuild
39+
# git clone --depth=1 --branch="wheelmaker" https://github.com/ecmwf/ci-utils wheelmaker # TODO use token here to get rid of the checkout action below
40+
- uses: actions/checkout@v4
41+
with:
42+
repository: ecmwf/ci-utils
43+
ref: develop
44+
path: ci-utils
45+
token: ${{ secrets.GH_REPO_READ_TOKEN }}
46+
- run: rm -rf proj && git clone --depth=1 --branch="${GITHUB_REF#refs/heads/}" https://github.com/$GITHUB_REPOSITORY proj
47+
- run: |
48+
cd proj && $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/prepare_deps.sh ./python_wrapper/buildconfig 3.11
49+
- run: |
50+
cd proj
51+
if [[ -f ./python_wrapper/pre-compile.sh ]] ; then ./python_wrapper/pre-compile.sh ; fi
52+
PATH="$PATH:$GITHUB_WORKSPACE/ecbuild/bin/" $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/compile.sh ./python_wrapper/buildconfig
53+
- run: |
54+
cd proj
55+
rm -rf /tmp/buildvenv && uv python install python3.11 && uv venv --python python3.11 /tmp/buildvenv && source /tmp/buildvenv/bin/activate && uv pip install build twine
56+
PYTHONPATH=$GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/wheel-linux.sh ./python_wrapper/buildconfig 3.11
57+
if [[ -f ./python_wrapper/post-build.sh ]] ; then ./python_wrapper/post-build.sh ; fi
58+
$GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/test-wheel.sh ./python_wrapper/buildconfig 3.11
59+
$GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/upload-pypi.sh ./python_wrapper/buildconfig
60+
env:
61+
TWINE_USERNAME: __token__
62+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
63+
# NOTE temporary thing until all the mess gets cleared
64+
- run: rm -rf ./* ./.git ./.github

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ doc/latex
66
*.sublime-workspace
77
.*.sw*
88
.*un~
9-
build*
9+
build/*
1010
docs/_build
1111
**/.ccls-cache
1212
__pycache__
1313
*.egg-info
14-
*.ipynb_checkpoints
14+
*.ipynb_checkpoints

python_wrapper/buildconfig

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# (C) Copyright 2025- ECMWF.
2+
#
3+
# This software is licensed under the terms of the Apache Licence Version 2.0
4+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5+
# In applying this licence, ECMWF does not waive the privileges and immunities
6+
# granted to it by virtue of its status as an intergovernmental organisation
7+
# nor does it submit to any jurisdiction.
8+
9+
# to be source'd by wheelmaker's compile.sh *and* wheel-linux.sh
10+
# NOTE replace the whole thing with pyproject.toml? Less powerful, and quaint to use for sourcing ecbuild invocation
11+
# TODO we duplicate information -- pyproject.toml's `name` and `packages` are derivable from $NAME and must stay consistent
12+
13+
NAME="multio"
14+
CMAKE_PARAMS1="-Deckit_ROOT=/tmp/multio/prereqs/eckitlib -Deccodes_ROOT=/tmp/multio/prereqs/eccodeslib -Dmetkit_ROOT=/tmp/multio/prereqs/metkitlib -Datlas_ROOT=/tmp/multio/prereqs/atlaslib -Dfdb5_ROOT=/tmp/multio/prereqs/fdblib -Dmir_ROOT=/tmp/multio/prereqs/mirlib -Dfckit_ROOT=/tmp/multio/prereqs/fckitlib"
15+
CMAKE_PARAMS2="-DENABLE_ATLAS_IO=0"
16+
CMAKE_PARAMS="$CMAKE_PARAMS1 $CMAKE_PARAMS2"
17+
PYPROJECT_DIR="python_wrapper"
18+
DEPENDENCIES='["eckitlib", "eccodeslib", "metkitlib", "atlaslib", "fdblib", "mirlib", "fckitlib"]'

python_wrapper/setup.cfg

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[metadata]
2+
description = "multiolib"
3+
long_description = file: README.md
4+
long_description_content_type = text/markdown
5+
author = file: AUTHORS

python_wrapper/setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from setup_utils import plain_setup
2+
plain_setup()

0 commit comments

Comments
 (0)