Skip to content

Commit afd19b7

Browse files
committed
Reflect new wheelmaker changes
1 parent d148455 commit afd19b7

File tree

2 files changed

+59
-155
lines changed

2 files changed

+59
-155
lines changed

.github/workflows/build-wheel-linux.yml

Lines changed: 48 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -11,153 +11,65 @@ name: Build Python Wheel for Linux
1111

1212
on:
1313
# 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-
# repository_dispatch:
21-
# types: [eccodes-updated]
14+
workflow_dispatch:
15+
inputs:
16+
use_test_pypi:
17+
description: Use test pypi instead of the regular one
18+
required: false
19+
type: boolean
20+
default: false
21+
22+
# Allow to be called from another workflow -- eg `cd.yml`
23+
workflow_call:
24+
inputs:
25+
use_test_pypi:
26+
description: Use test pypi instead of the regular one
27+
required: false
28+
type: boolean
29+
default: false
2230

2331
jobs:
24-
build-python-wheel:
32+
build:
2533
name: Build manylinux_2_28
26-
runs-on: [self-hosted, Linux, platform-builder-Rocky-8.6]
27-
container:
28-
image: dockcross/manylinux_2_28-x64:20250109-7bf589c
29-
#options: --pull always
30-
31-
name: Build manylinux_2_28-x64
32-
33-
steps:
34-
- uses: actions/checkout@v4
35-
36-
- run: ./scripts/build-linux.sh
37-
38-
################################################################
39-
- run: ./scripts/wheel-linux.sh 3.8
40-
- uses: actions/upload-artifact@v4
41-
name: Upload wheel 3.8
42-
with:
43-
name: wheel-manylinux2014-3.8
44-
path: wheelhouse/*.whl
45-
46-
# ################################################################
47-
- run: ./scripts/wheel-linux.sh 3.9
48-
- uses: actions/upload-artifact@v4
49-
name: Upload wheel 3.9
50-
with:
51-
name: wheel-manylinux2014-3.9
52-
path: wheelhouse/*.whl
53-
54-
# ################################################################
55-
- run: ./scripts/wheel-linux.sh 3.10
56-
- uses: actions/upload-artifact@v4
57-
name: Upload wheel 3.10
58-
with:
59-
name: wheel-manylinux2014-3.10
60-
path: wheelhouse/*.whl
61-
62-
# ################################################################
63-
- run: ./scripts/wheel-linux.sh 3.11
64-
- uses: actions/upload-artifact@v4
65-
name: Upload wheel 3.11
66-
with:
67-
name: wheel-manylinux2014-3.11
68-
path: wheelhouse/*.whl
69-
70-
# ################################################################
71-
- run: ./scripts/wheel-linux.sh 3.12
72-
- uses: actions/upload-artifact@v4
73-
name: Upload wheel 3.12
74-
with:
75-
name: wheel-manylinux2014-3.12
76-
path: wheelhouse/*.whl
77-
78-
# ################################################################
79-
- run: ./scripts/wheel-linux.sh 3.13
80-
- uses: actions/upload-artifact@v4
81-
name: Upload wheel 3.13
82-
with:
83-
name: wheel-manylinux2014-3.13
84-
path: wheelhouse/*.whl
85-
86-
test:
87-
88-
needs: build
89-
9034
strategy:
91-
fail-fast: false
92-
matrix: # We don't test 3.6, as it is not supported anymore by github actions
93-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
94-
95-
runs-on: [self-hosted, Linux, platform-builder-Rocky-8.6]
96-
97-
name: Test with ${{ matrix.python-version }}
98-
99-
steps:
100-
101-
- uses: actions/checkout@v4
102-
103-
- uses: actions/download-artifact@v4
104-
with:
105-
name: wheel-manylinux2014-${{ matrix.python-version }}
106-
107-
- run: ./scripts/test-linux.sh ${{ matrix.python-version }}
108-
109-
110-
deploy:
111-
112-
if: ${{ github.ref_type == 'tag' || github.event_name == 'release' }}
113-
114-
strategy:
115-
fail-fast: false
35+
fail-fast: true
11636
matrix:
117-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
118-
119-
needs: [test, build]
120-
121-
name: Deploy wheel ${{ matrix.python-version }}
122-
123-
runs-on: [self-hosted, Linux, platform-builder-Rocky-8.6]
124-
125-
126-
steps:
127-
128-
- run: mkdir artifact-${{ matrix.python-version }}
129-
130-
- uses: actions/checkout@v4
131-
132-
- uses: actions/download-artifact@v4
133-
with:
134-
name: wheel-manylinux2014-${{ matrix.python-version }}
135-
path: artifact-${{ matrix.python-version }}
136-
137-
build-wrapper-wheel:
138-
name: Build manylinux_2_28
37+
python-version: ["3.11"] # ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] # TODO re-enable post-devel
13938
runs-on: [self-hosted, Linux, platform-builder-Rocky-8.6]
14039
container:
141-
image: eccr.ecmwf.int/wheelmaker/2_28:latest
40+
image: eccr.ecmwf.int/wheelmaker/2_28:1.latest
14241
credentials:
14342
username: ${{ secrets.ECMWF_DOCKER_REGISTRY_USERNAME }}
14443
password: ${{ secrets.ECMWF_DOCKER_REGISTRY_ACCESS_TOKEN }}
14544
steps:
146-
# TODO convert this to be matrix-friendly. Note it's a bit tricky since
147-
# we'd ideally not reexecute the compile step multiple times, but it
148-
# (non-essentially) depends on a matrix-based step
149-
# NOTE we dont use action checkout because it doesnt cleanup after itself correctly
150-
- run: git clone --depth=1 --branch="${GITHUB_REF#refs/heads/}" https://github.com/$GITHUB_REPOSITORY /proj
151-
- run: cd /proj && /buildscripts/prepare_deps.sh ./buildconfig 3.11
15245
- run: |
153-
cd /proj
154-
export PYTHONPATH=/buildscripts/; export LIBDIR=/tmp/prereqs/eccodeslib/lib64; export INCDIR=/tmp/prereqs/eccodeslib/include
155-
uv run --python python3.11 python -m build --installer uv --wheel .
156-
- run: mkdir -p /build/wheel && mv /proj/dist/*whl /build/wheel
157-
- run: cd /proj && /buildscripts/test-wheel.sh ./python_wrapper/buildconfig 3.11 /build/wheel/*whl
158-
- run: cd /proj && /buildscripts/upload-pypi.sh /build/wheel/*whl
46+
set -euo pipefail
47+
git clone --depth=1 --branch="${GITHUB_REF#refs/heads/}" https://github.com/$GITHUB_REPOSITORY /proj
48+
cd /proj
49+
if [ "$GITHUB_REF_NAME" != "main" -a "$GITHUB_REF_NAME" != "master" -a "$GITHUB_REF_TYPE" != "tag" ] ; then
50+
export UV_CACHE_DIR="/tmp/reallynocache"
51+
rm -rf $UV_CACHE_DIR && mkdir $UV_CACHE_DIR
52+
EXTRA_PIP="--refresh --no-cache --prerelease=allow"
53+
else
54+
EXTRA_PIP=""
55+
fi
56+
57+
VENV_ROOT=/venv/build"${{ matrix.python_version }}"
58+
source $VENV_ROOT/bin/activate
59+
uv pip install $EXTRA_PIP eccodeslib
60+
EL_ROOT=$VENV_ROOT/lib/python"${{ matrix.python_version }}"/site-packages/lib64/eccodeslib
61+
export LIBDIR=$EL_ROOT/lib64
62+
export INCDIR=$EL_ROOT/include
63+
python -m build --no-isolation .
64+
65+
uv pip install ./dist/* pytest
66+
cd tests
67+
ECCODES_PYTHON_TRACE_LIB_SEARCH=1 pytest -v -s
68+
cd ..
69+
70+
if [ "${{ inputs.use_test_pypi }}" = "true" ] ; then UPLOAD_TO=test ; else UPLOAD_TO=prod ; fi
71+
PYTHONPATH=/buildscripts /buildscripts/upload-pypi.sh $UPLOAD_TO ./dist
15972
env:
16073
TWINE_USERNAME: __token__
161-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
162-
# NOTE temporary thing until all the mess gets cleared
163-
- run: rm -rf ./* ./.git ./.github
74+
TWINE_PASSWORD_PROD: ${{ secrets.PYPI_API_TOKEN }}
75+
TWINE_PASSWORD_TEST: ${{ secrets.PYPI_TEST_API_TOKEN }}

setup.py

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
# TODO ideally merge this with wheelmaker's setup_utils somehow
1010

1111
import io
12+
import importlib.metadata
1213
import os
1314
import re
1415
import sys
1516
import setuptools
16-
from setup_utils import parse_dependencies, ext_kwargs
1717

1818

1919
install_requires = [
@@ -23,7 +23,8 @@
2323
"numpy ; python_version >= '3.9'",
2424
"attrs",
2525
"cffi",
26-
"findlibs", # TODO add lb here once released
26+
"findlibs>=0.1.1",
27+
"eckitlib",
2728
]
2829

2930
ext_modules = [
@@ -48,14 +49,19 @@ def get_version() -> str:
4849
raise ValueError("couldn't parse version")
4950
return version_match.group(1)
5051

52+
def get_eccodeslib_dep() -> list[str]:
53+
eccodes_version = importlib.metadata.version("eccodeslib")
54+
mj, mn, pt = eccodes_version.split('.', 2)
55+
return [
56+
f"eccodeslib >= {ver}, < {int(mj)+1}",
57+
]
58+
5159
setuptools.setup(
5260
name="eccodes",
5361
version=get_version(),
5462
packages=setuptools.find_packages(),
5563
package_data={"": ["**/*.h"]},
56-
install_requires=parse_dependencies() + install_requires,
57-
**ext_kwargs[sys.platform],
58-
# NOTE what is this? Setuptools 75.6.0 doesnt recognize. Move to extras?
64+
install_requires=get_eccodeslib_dep() + install_requires,
5965
tests_require=[
6066
"pytest",
6167
"pytest-cov",
@@ -64,19 +70,5 @@ def get_version() -> str:
6470
test_suite="tests",
6571
zip_safe=True,
6672
keywords="ecCodes GRIB BUFR",
67-
classifiers=[
68-
"Development Status :: 4 - Beta",
69-
"Intended Audience :: Developers",
70-
"License :: OSI Approved :: Apache Software License",
71-
"Programming Language :: Python :: 3.8",
72-
"Programming Language :: Python :: 3.9",
73-
"Programming Language :: Python :: 3.10",
74-
"Programming Language :: Python :: 3.11",
75-
"Programming Language :: Python :: 3.12",
76-
"Programming Language :: Python :: 3.13",
77-
"Programming Language :: Python :: Implementation :: CPython",
78-
"Programming Language :: Python :: Implementation :: PyPy",
79-
"Operating System :: OS Independent",
80-
],
8173
ext_modules=ext_modules,
8274
)

0 commit comments

Comments
 (0)