From f88231c7c160cb28f0a1730aac66f988afea3be5 Mon Sep 17 00:00:00 2001 From: Marian Koop Date: Tue, 11 Aug 2026 21:08:45 +0200 Subject: [PATCH] ci: Add Python 3.13 support --- .../uhd-builder-vs2022-v143-x64.Dockerfile | 9 +++++++- .../uhd-builder-vs2026-v145-x64.Dockerfile | 9 +++++++- .ci/templates/job-get-latest-uhd-docker.yml | 2 +- ...steps-build-uhd-installer-msbuild-nsis.yml | 22 ++++++++++++++++++- host/python/pyproject.toml.in | 5 ++++- host/python/requirements_np2.txt | 16 ++++++++++++++ 6 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 host/python/requirements_np2.txt diff --git a/.ci/docker/uhd-builder-vs2022-v143-x64.Dockerfile b/.ci/docker/uhd-builder-vs2022-v143-x64.Dockerfile index 533aa4cb5..a951ccf14 100644 --- a/.ci/docker/uhd-builder-vs2022-v143-x64.Dockerfile +++ b/.ci/docker/uhd-builder-vs2022-v143-x64.Dockerfile @@ -61,9 +61,16 @@ RUN if defined PIP_INDEX_URL ( \ ) COPY host/python/requirements.txt C:/Temp/requirements.txt +COPY host/python/requirements_np2.txt C:/Temp/requirements_np2.txt RUN pip config list && \ python -m pip install --upgrade pip && \ - python -m pip install -r C:/Temp/requirements.txt + powershell -NoProfile -ExecutionPolicy Bypass -Command \ + "if ([version]('%PYTHON_VERSION%') -ge [version]('3.13')) { \ + pip install -r C:/Temp/requirements_np2.txt \ + } else { \ + pip install -r C:/Temp/requirements.txt \ + }; \ + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }" RUN setx VCPKG_INSTALL_DIR "c:\\vcpkg" /m RUN git clone https://github.com/microsoft/vcpkg %VCPKG_INSTALL_DIR% && \ diff --git a/.ci/docker/uhd-builder-vs2026-v145-x64.Dockerfile b/.ci/docker/uhd-builder-vs2026-v145-x64.Dockerfile index a52b3f5c9..0657dded2 100644 --- a/.ci/docker/uhd-builder-vs2026-v145-x64.Dockerfile +++ b/.ci/docker/uhd-builder-vs2026-v145-x64.Dockerfile @@ -61,9 +61,16 @@ RUN if defined PIP_INDEX_URL ( \ ) COPY host/python/requirements.txt C:/Temp/requirements.txt +COPY host/python/requirements_np2.txt C:/Temp/requirements_np2.txt RUN pip config list && \ python -m pip install --upgrade pip && \ - python -m pip install -r C:/Temp/requirements.txt + powershell -NoProfile -ExecutionPolicy Bypass -Command \ + "if ([version]('%PYTHON_VERSION%') -ge [version]('3.13')) { \ + pip install -r C:/Temp/requirements_np2.txt \ + } else { \ + pip install -r C:/Temp/requirements.txt \ + }; \ + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }" RUN setx VCPKG_INSTALL_DIR "c:\\vcpkg" /m RUN git clone https://github.com/microsoft/vcpkg %VCPKG_INSTALL_DIR% && \ diff --git a/.ci/templates/job-get-latest-uhd-docker.yml b/.ci/templates/job-get-latest-uhd-docker.yml index ac648b7f6..d3440f08f 100644 --- a/.ci/templates/job-get-latest-uhd-docker.yml +++ b/.ci/templates/job-get-latest-uhd-docker.yml @@ -46,7 +46,7 @@ jobs: # PR runs also use fallback mode. # The behavior is implemented by derive_docker_image_matrix.py. docker_image_matrix_lin=$(python3 "$derive_script" --empty-on-error-non-ci --input "$artifact_file" --type build --os linux) - docker_image_matrix_win=$(python3 "$derive_script" --empty-on-error-non-ci --input "$artifact_file" --type build --os windows --filter-out "VS2022-x64-py313-builder") + docker_image_matrix_win=$(python3 "$derive_script" --empty-on-error-non-ci --input "$artifact_file" --type build --os windows) docker_image_matrix_ubuntu_deb=$(python3 "$derive_script" --empty-on-error-non-ci --input "$artifact_file" --type installer --os linux --package deb --filter-out "focal,questing") docker_image_matrix_source_package=$(python3 "$derive_script" --empty-on-error-non-ci --input "$artifact_file" --type source --os linux --select noble) docker_image_matrix_fedora_rpm=$(python3 "$derive_script" --empty-on-error-non-ci --input "$artifact_file" --type installer --os linux --package rpm) diff --git a/.ci/templates/steps-build-uhd-installer-msbuild-nsis.yml b/.ci/templates/steps-build-uhd-installer-msbuild-nsis.yml index e6e9e62de..0f6b8f309 100644 --- a/.ci/templates/steps-build-uhd-installer-msbuild-nsis.yml +++ b/.ci/templates/steps-build-uhd-installer-msbuild-nsis.yml @@ -35,6 +35,20 @@ parameters: steps: - script: | + setlocal enabledelayedexpansion + echo pythonVersion=$(pythonVersion) + if "$(pythonVersion)"=="python310" ( + set pyVersionType=1 + ) else if "$(pythonVersion)"=="python311" ( + set pyVersionType=1 + ) else if "$(pythonVersion)"=="python312" ( + set pyVersionType=1 + ) else ( + set pyVersionType=2 + ) + echo pyVersionType=!pyVersionType! + echo ##vso[task.setvariable variable=PYVERSIONTYPE]!pyVersionType! + echo environment var VCPKG_TARGET_TRIPLET=%VCPKG_TARGET_TRIPLET% call ${{ parameters.uhdSrcDir }}\.ci\utils\extract-vs-version.bat "$(cmakeCompiler)" copy /y ${{ parameters.uhdSrcDir }}\.ci\docker\vcpkg\%vcpkgManifestFile% vcpkg.json @@ -45,7 +59,13 @@ steps: - script: | pip config list python -m pip install --upgrade pip - pip install -r ${{ parameters.uhdSrcDir }}\host\python\requirements.txt + if "%PYVERSIONTYPE%"=="1" ( + pip install -r ${{ parameters.uhdSrcDir }}\host\python\requirements.txt + ) else ( + echo Using numpy 2.x requirements for python313 and above + pip install -r ${{ parameters.uhdSrcDir }}\host\python\requirements_np2.txt + pip install "pybind11>=2.12" + ) displayName: refresh python dependencies - script: | diff --git a/host/python/pyproject.toml.in b/host/python/pyproject.toml.in index cb6a14a68..516df1c66 100644 --- a/host/python/pyproject.toml.in +++ b/host/python/pyproject.toml.in @@ -18,7 +18,10 @@ exclude = [ [tool.poetry.dependencies] python = ">=3.10,<3.14" -numpy = "^@UHD_NUMPY_MIN_VERSION@" +numpy = [ + {version = ">=2.0.0", python = ">=3.13"}, + {version = ">=@UHD_NUMPY_MIN_VERSION@,<2.0.0", python = "<3.13"} +] mako = ">=@UHD_PY_MAKO_MIN_VERSION@" ruamel-yaml = ">=@UHD_RUAMEL_YAML_MIN_VERSION@" diff --git a/host/python/requirements_np2.txt b/host/python/requirements_np2.txt new file mode 100644 index 000000000..61a5ddd41 --- /dev/null +++ b/host/python/requirements_np2.txt @@ -0,0 +1,16 @@ +# Python packages required to build UHD with Python support + +# Process yaml files, e.g. for RFNoC image builder +ruamel.yaml + +# Numpy is used to generate or process IQ data +numpy >= 2.0.0 + +# Mako is needed for generate source stubs (e.g. register maps) +mako + +# Needed for the image downloader +requests + +# Needed to build the Python bindings for UHD +setuptools