From 231cff37c596f07762bdd8c505039b110b536dc4 Mon Sep 17 00:00:00 2001 From: Alex Vergara Gil Date: Wed, 20 May 2026 18:24:01 +0200 Subject: [PATCH 1/8] rebase --- .github/workflows/actions_build/action.yml | 20 +- .../actions_build/ci_build_wheel_macos.sh | 80 ++++---- .../actions_build/ci_build_wheel_ubuntu.sh | 64 +++++-- .../actions_build/ci_build_wheel_windows.sh | 36 ++-- .github/workflows/createWheelLinux.sh | 24 --- .github/workflows/delocateWindows.py | 171 ------------------ .github/workflows/main.yml | 24 +-- core/CMakeLists.txt | 2 +- core/VERSION | 1 + core/setup.py | 2 +- 10 files changed, 137 insertions(+), 287 deletions(-) delete mode 100755 .github/workflows/createWheelLinux.sh delete mode 100644 .github/workflows/delocateWindows.py create mode 100644 core/VERSION diff --git a/.github/workflows/actions_build/action.yml b/.github/workflows/actions_build/action.yml index 86f6d55c2c..36bd3f3fe2 100755 --- a/.github/workflows/actions_build/action.yml +++ b/.github/workflows/actions_build/action.yml @@ -8,10 +8,10 @@ inputs: runs: using: "composite" steps: - - name: Set up Python ${{ inputs.python-version }} + - name: Set up Python 3.14 uses: actions/setup-python@v6 with: - python-version: ${{ inputs.python-version }} + python-version: '3.14' - name: Get OS version id: get-os-version shell: bash -l {0} @@ -45,7 +45,7 @@ runs: fi - name: Cache modules id: cache_opengate_core_dependencies - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: ~/software key: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_build @@ -56,11 +56,19 @@ runs: miniconda-version: "latest" auto-update-conda: true activate-environment: opengate_core - python-version: ${{ inputs.python-version }} + python-version: '3.14' - name: Set up Homebrew if: (inputs.os == 'macos-15') || (inputs.os == 'macos-15-intel') id: set-up-homebrew - uses: Homebrew/actions/setup-homebrew@master + uses: Homebrew/actions/setup-homebrew@main + # - name: Cache Homebrew prefix + # if: (inputs.os == 'macos-15') || (inputs.os == 'macos-15-intel') + # id: cache-homebrew + # uses: Homebrew/actions/cache-homebrew-prefix@main + # with: + # install: wget ccache fftw libomp qt xerces-c cmake + # uninstall: true + # workflow-key: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_homebrew - name: Create opengate_core Wheel Linux if: (inputs.os == 'ubuntu-24.04') || (inputs.os == 'ubuntu-24.04-arm') env: @@ -76,6 +84,7 @@ runs: MATRIX_OS: ${{ inputs.os }} MATRIX_PYTHON_VERSION: ${{ inputs.python-version }} MATRIX_CACHE: ${{ steps.cache_opengate_core_dependencies.outputs.cache-hit }} + # BREW_CACHE: ${{ steps.cache_homebrew.outputs.cache-hit }} shell: bash -l {0} run: | export > $GITHUB_WORKSPACE/env_dump.txt @@ -85,6 +94,7 @@ runs: env: MATRIX_CACHE: ${{ steps.cache_opengate_core_dependencies.outputs.cache-hit }} MATRIX_PYTHON_VERSION: ${{ inputs.python-version }} + MATRIX_OS: ${{ inputs.os }} shell: bash -l {0} run: | export > $GITHUB_WORKSPACE\\env_dump.txt diff --git a/.github/workflows/actions_build/ci_build_wheel_macos.sh b/.github/workflows/actions_build/ci_build_wheel_macos.sh index f911c9705b..1c20e5b58c 100755 --- a/.github/workflows/actions_build/ci_build_wheel_macos.sh +++ b/.github/workflows/actions_build/ci_build_wheel_macos.sh @@ -2,34 +2,30 @@ set -e source $GITHUB_WORKSPACE/env_dump.txt -brew install python@${MATRIX_PYTHON_VERSION} || true -brew link --overwrite python@${MATRIX_PYTHON_VERSION} -#brew update -#rm -rf /usr/local/bin/python3.1*-config /usr/local/bin/2to3-3.1* /usr/local/bin/idle3.1* /usr/local/bin/pydoc3.1* /usr/local/bin/python3.1* -#rm -rf /usr/local/bin/python3-config /usr/local/bin/2to3 /usr/local/bin/idle3 /usr/local/bin/pydoc3 /usr/local/bin/python3 -brew install --force --verbose --overwrite \ - ccache \ - fftw \ - libomp \ - xquartz \ - xerces-c \ - wget || true -brew uninstall --ignore-dependencies libxext -brew uninstall --ignore-dependencies libx11 + +if [ "${BREW_CACHE}" != 'true' ]; then + brew install --force --verbose --overwrite \ + ccache \ + fftw \ + libomp \ + qt \ + xerces-c || true + + brew uninstall --ignore-dependencies libxext + brew uninstall --ignore-dependencies libx11 +fi + export LDFLAGS="-L/usr/local/opt/llvm/lib" export CPPFLAGS="-I/usr/local/opt/llvm/include -fopenmp" conda info conda list -which python -python --version export PATH="/usr/local/miniconda/envs/opengate_core/bin/:$PATH" +export QT_PLUGIN_DIR=$(qtpaths6 --plugin-dir) +echo "QT_PLUGIN_DIR is $QT_PLUGIN_DIR" pip install wget colored setuptools -pip install wheel delocate -if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then - conda install conda-forge::qt6-main conda-forge::qt6-3d -else - brew install qt -fi +# install cibuildwheel +pip install cibuildwheel[uv]==3.4.0 + mkdir -p $HOME/software if [ "${MATRIX_CACHE}" != 'true' ]; then cd $HOME/software @@ -67,28 +63,38 @@ cd $GITHUB_WORKSPACE source $HOME/software/geant4/bin/geant4make.sh export CMAKE_PREFIX_PATH=$HOME/software/geant4/bin:$HOME/software/itk/bin/:${CMAKE_PREFIX_PATH} cd core + mkdir opengate_core/plugins -if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then - cp -r /Users/runner/miniconda3/envs/opengate_core/lib/qt6/plugins/platforms/* opengate_core/plugins/ - cp -r /Users/runner/miniconda3/envs/opengate_core/lib/qt6/plugins/imageformats opengate_core/plugins/ -else - cp -r /opt/homebrew/share/qt/plugins/platforms/* opengate_core/plugins/ - cp -r /opt/homebrew/share/qt/plugins/imageformats/* opengate_core/plugins/ -fi -python3 setup.py sdist bdist_wheel -ls dist +cp -r $QT_PLUGIN_DIR/platforms/* opengate_core/plugins/ +cp -r $QT_PLUGIN_DIR/imageformats/* opengate_core/plugins/ + +export CIBW_BUILD_FRONTEND="build[uv]" +export CIBW_PLATFORM="macos" +export CIBW_SKIP="*t*" +export MACOSX_DEPLOYMENT_TARGET=15.0 +export CIBW_BEFORE_BUILD="uv pip install colored" + if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then export DYLD_LIBRARY_PATH=$HOME/software/geant4/bin/BuildProducts/lib:/Users/runner/miniconda3/envs/opengate_core/lib/qt6/plugins/platforms:/opt/X11/lib/:$DYLD_LIBRARY_PATH:/Users/runner/miniconda3/envs/opengate_core/lib + export CIBW_ARCHS_MACOS="x86_64" else export DYLD_LIBRARY_PATH=$HOME/software/geant4/bin/BuildProducts/lib:/opt/homebrew/share/qt/plugins/platforms/:/opt/X11/lib/:$DYLD_LIBRARY_PATH:/opt/homebrew/lib + export CIBW_ARCHS_MACOS="arm64" python -c "import os,delocate; print(os.path.join(os.path.dirname(delocate.__file__), 'tools.py'));quit()" | xargs -I{} sed -i."" "s/first, /input.pop('i386',None); first, /g" {} fi -delocate-listdeps --all dist/*.whl -delocate-wheel -w fixed_wheels -v dist/*.whl -rm -rf dist -ls fixed_wheels -delocate-listdeps --all fixed_wheels/*.whl -mv fixed_wheels dist +if [[ ${MATRIX_PYTHON_VERSION} == "3.10" ]]; then + export CIBW_BUILD="cp310-*" +elif [[ ${MATRIX_PYTHON_VERSION} == "3.11" ]]; then + export CIBW_BUILD="cp311-*" +elif [[ ${MATRIX_PYTHON_VERSION} == "3.12" ]]; then + export CIBW_BUILD="cp312-*" +elif [[ ${MATRIX_PYTHON_VERSION} == "3.13" ]]; then + export CIBW_BUILD="cp313-*" +elif [[ ${MATRIX_PYTHON_VERSION} == "3.14" ]]; then + export CIBW_BUILD="cp314-*" +fi + +python -m cibuildwheel --output-dir dist cd dist if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then find . -name '*whl' -exec bash -c ' mv $0 ${0/macosx_15_0/macosx_10_9}' {} \; diff --git a/.github/workflows/actions_build/ci_build_wheel_ubuntu.sh b/.github/workflows/actions_build/ci_build_wheel_ubuntu.sh index 51bc33fbbe..8e84814e25 100755 --- a/.github/workflows/actions_build/ci_build_wheel_ubuntu.sh +++ b/.github/workflows/actions_build/ci_build_wheel_ubuntu.sh @@ -2,23 +2,53 @@ set -e source $GITHUB_WORKSPACE/env_dump.txt -if [ ${MATRIX_PYTHON_VERSION} == "3.10" ]; then - export PYTHONFOLDER="cp310-cp310" -elif [ ${MATRIX_PYTHON_VERSION} == "3.11" ]; then - export PYTHONFOLDER="cp311-cp311" -elif [ ${MATRIX_PYTHON_VERSION} == "3.12" ]; then - export PYTHONFOLDER="cp312-cp312" -elif [ ${MATRIX_PYTHON_VERSION} == "3.13" ]; then - export PYTHONFOLDER="cp313-cp313" -elif [ ${MATRIX_PYTHON_VERSION} == "3.14" ]; then - export PYTHONFOLDER="cp314-cp314" -fi -mkdir -p $HOME/software + +pip install wget colored setuptools +pip install cibuildwheel[uv]==3.4.0 + +# Setup the environment for the build if [ ${MATRIX_OS} == "ubuntu-24.04-arm" ]; then export ARMDOCKER="_arm64" + export CIBW_ARCHS="aarch64" + export CIBW_MANYLINUX_AARCH64_IMAGE=tbaudier/opengate_core:${GEANT4_VERSION}$ARMDOCKER +else + export CIBW_ARCHS="x86_64" + export CIBW_MANYLINUX_X86_64_IMAGE=tbaudier/opengate_core:${GEANT4_VERSION} fi -docker run --rm -e "PYTHONFOLDER=${PYTHONFOLDER}" -v $GITHUB_WORKSPACE:/home tbaudier/opengate_core:${GEANT4_VERSION}$ARMDOCKER /home/.github/workflows/createWheelLinux.sh -ls wheelhouse -rm -rf dist -mv wheelhouse dist -sudo chown -R runner:docker dist \ No newline at end of file +if [[ ${MATRIX_PYTHON_VERSION} == "3.10" ]]; then + export CIBW_BUILD="cp310-*" +elif [[ ${MATRIX_PYTHON_VERSION} == "3.11" ]]; then + export CIBW_BUILD="cp311-*" +elif [[ ${MATRIX_PYTHON_VERSION} == "3.12" ]]; then + export CIBW_BUILD="cp312-*" +elif [[ ${MATRIX_PYTHON_VERSION} == "3.13" ]]; then + export CIBW_BUILD="cp313-*" +elif [[ ${MATRIX_PYTHON_VERSION} == "3.14" ]]; then + export CIBW_BUILD="cp314-*" +fi +export CIBW_PLATFORM="linux" +export CIBW_BUILD_FRONTEND="build[uv]" +export CIBW_SKIP="*-musllinux_* *t*" +export CIBW_BEFORE_BUILD=' +pip install colored && +mkdir -p opengate_core/plugins && +export QT_PLUGIN_DIR=$(qtpaths6 --plugin-dir) && +cp -r -n $QT_PLUGIN_DIR/platforms/* opengate_core/plugins/ && +cp -r -n $QT_PLUGIN_DIR/imageformats opengate_core/plugins/ && +source /software/geant4/bin/geant4make.sh && +. /opt/rh/gcc-toolset-14/enable +' + +# expose external libraries to build environment +export CIBW_ENVIRONMENT=' +CMAKE_PREFIX_PATH=/software/geant4/bin:/software/itk/bin/ +Geant4_DIR=/software/geant4/lib/cmake/Geant4 +ITK_DIR=/software/itk/lib/cmake/ITK +LD_LIBRARY_PATH=/software/geant4/lib:/software/itk/lib +' + +# Run the build in custom docker +cd core +python -m cibuildwheel --output-dir dist +mkdir -p $GITHUB_WORKSPACE/dist +mv dist/*.whl $GITHUB_WORKSPACE/dist/ \ No newline at end of file diff --git a/.github/workflows/actions_build/ci_build_wheel_windows.sh b/.github/workflows/actions_build/ci_build_wheel_windows.sh index e22949d204..acac707f70 100755 --- a/.github/workflows/actions_build/ci_build_wheel_windows.sh +++ b/.github/workflows/actions_build/ci_build_wheel_windows.sh @@ -6,14 +6,13 @@ source $CONDA/Scripts/activate opengate_core conda info conda install cmake==3.31.2 cmake --version -conda install openssl==3.0.19 conda list which python python --version export PATH="/usr/local/miniconda/envs/opengate_core/bin/:$PATH" -pip install wheel wget colored +pip install wget colored delvewheel -pip install cibuildwheel==3.4.0 +pip install cibuildwheel[uv]==3.4.0 # For windows 2025, Need to add the certifi CA bundle to avoid SSL errors when downloading dependencies during the build. This is a workaround for cibuildwheel which does not handle this properly on Windows. python - << 'EOF' @@ -55,24 +54,37 @@ source $HOME/software/geant4/bin/geant4make.sh export CMAKE_PREFIX_PATH=$HOME/software/geant4/bin:$HOME/software/itk/bin/:${CMAKE_PREFIX_PATH} cd core if [[ ${MATRIX_PYTHON_VERSION} == "3.10" ]]; then - export CIBW_BUILD="cp310-win_amd64" + export CIBW_BUILD="cp310-*" elif [[ ${MATRIX_PYTHON_VERSION} == "3.11" ]]; then - export CIBW_BUILD="cp311-win_amd64" + export CIBW_BUILD="cp311-*" elif [[ ${MATRIX_PYTHON_VERSION} == "3.12" ]]; then - export CIBW_BUILD="cp312-win_amd64" + export CIBW_BUILD="cp312-*" elif [[ ${MATRIX_PYTHON_VERSION} == "3.13" ]]; then - export CIBW_BUILD="cp313-win_amd64" + export CIBW_BUILD="cp313-*" elif [[ ${MATRIX_PYTHON_VERSION} == "3.14" ]]; then - export CIBW_BUILD="cp314-win_amd64" + export CIBW_BUILD="cp314-*" fi +echo ${MATRIX_OS} +if [[ ${MATRIX_OS} == "windows-11-arm" ]]; then + export CIBW_ARCHS="ARM64" +else + export CIBW_ARCHS="AMD64" +fi +export CIBW_BUILD_FRONTEND="build[uv]" +export CIBW_SKIP="*t*" +export CIBW_PLATFORM="windows" find $HOME/software/geant4/bin/ -iname "*.dll" ls $HOME/software/geant4/bin/BuildProducts/Release/bin ls $HOME/software/geant4/bin/BuildProducts/Release/lib/ -export CIBW_BEFORE_BUILD="python -m pip install colored" + +# use delvewheel on windows +export CIBW_BEFORE_BUILD_WINDOWS="uv pip install colored" +export CIBW_REPAIR_WHEEL_COMMAND_WINDOWS='' python -m cibuildwheel --output-dir dist + cd .. mkdir core/dist2 -pip install pefile machomachomangler -ls core/dist -python $GITHUB_WORKSPACE\\.github\\workflows\\delocateWindows.py core\\dist -w core\\dist2 -d C:\\Users\\runneradmin\\software\\geant4\\bin\\BuildProducts\\Release\\bin +delvewheel repair -w core/dist2 core/dist/*.whl --add-path $HOME/software/geant4/bin/BuildProducts/Release/bin -vv + +ls core/dist2 mv core/dist2 dist diff --git a/.github/workflows/createWheelLinux.sh b/.github/workflows/createWheelLinux.sh deleted file mode 100755 index 0363fb9be2..0000000000 --- a/.github/workflows/createWheelLinux.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -e -x -echo ${PYTHONFOLDER} -cd /home/core/ -export PATH=/software/cmake/cmake/bin/:${PATH} -source /software/geant4/bin/geant4make.sh -export CMAKE_PREFIX_PATH=/software/geant4/bin:/software/itk/bin/:${CMAKE_PREFIX_PATH} -. /opt/rh/gcc-toolset-14/enable -mkdir opengate_core/plugins -cp -r /lib64/qt6/plugins/platforms/* opengate_core/plugins/ -cp -r /lib64/qt6/plugins/imageformats opengate_core/plugins/ -/opt/python/${PYTHONFOLDER}/bin/pip install wget colored setuptools -export PYBIND11_FINDPYTHON=OLD -/opt/python/${PYTHONFOLDER}/bin/python setup.py sdist bdist_wheel -archi=`uname -m` -if [ "$(uname -m)" = "aarch64" ]; then - auditwheel repair /home/core/dist/*.whl -w /software/wheelhouse/ --plat "manylinux_2_34_aarch64" -else - auditwheel repair /home/core/dist/*.whl -w /software/wheelhouse/ --plat "manylinux_2_34_x86_64" -fi -cp -r /software/wheelhouse /home/ -#/opt/python/${PYTHONFOLDER}/bin/pip install twine -#/opt/python/${PYTHONFOLDER}/bin/twine upload --repository-url https://test.pypi.org/legacy/ wheelhouse/*manylinux2014*.whl diff --git a/.github/workflows/delocateWindows.py b/.github/workflows/delocateWindows.py deleted file mode 100644 index 3991c10891..0000000000 --- a/.github/workflows/delocateWindows.py +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/env python - -print("------------ Delocate for Windows ----------") - -import os -import glob -import shutil -import pathlib -import hashlib -import zipfile -import argparse -import tempfile -from datetime import datetime - -now = datetime.now() -print(now.strftime("%H:%M:%S")) - -import pefile -from machomachomangler.pe import redll - -# From https://github.com/duburcqa/jiminy/blob/dev/build_tools/wheel_repair_win.py - -WHITE_LIST_DEPS = ("boost_python",) # "boost_numpy", "eigenpy", "hpp-fcl", "pinocchio") - -global_dll_deps = {} - - -def hash_filename(filepath, blocksize=65536): - # Split original filename from extension - root, ext = os.path.splitext(filepath) - filename = os.path.basename(root) - - # Do NOT hash filename to make it unique in the particular case of boost - # python modules. It is necessary for cross-module interoperability. - if any(pattern in filepath for pattern in WHITE_LIST_DEPS): - return f"{filename}{ext}" - - # Compute unique hash based on file's content - hasher = hashlib.sha256() - with open(filepath, "rb") as afile: - buf = afile.read(blocksize) - while len(buf) > 0: - hasher.update(buf) - buf = afile.read(blocksize) - - return f"{filename}-{hasher.hexdigest()[:8]}{ext}" - - -def find_dll_dependencies(dll_filepath, lib_dir): - print(dll_filepath) - if dll_filepath in global_dll_deps: - return global_dll_deps[dll_filepath] - else: - dll_deps = {} - entries = pefile.PE(dll_filepath).DIRECTORY_ENTRY_IMPORT - for entry in entries: - entry_name = entry.dll.decode("utf-8") - print(entry_name) - if entry_name in os.listdir(lib_dir): - dll_deps.setdefault(os.path.basename(dll_filepath), set()).add( - entry_name - ) - nested_dll_deps = find_dll_dependencies( - os.path.join(lib_dir, entry_name), lib_dir - ) - dll_deps.update(nested_dll_deps) - global_dll_deps[dll_filepath] = dll_deps - return global_dll_deps[dll_filepath] - - -def mangle_filename(old_filename, new_filename, mapping): - with open(old_filename, "rb") as f: - buf = f.read() - new_buf = redll(buf, mapping) - with open(new_filename, "wb") as f: - f.write(new_buf) - - -parser = argparse.ArgumentParser( - description="Vendor in external shared library dependencies of a wheel." -) - -parser.add_argument("WHEEL_FILE", type=str, help="Path to wheel file") -parser.add_argument( - "-d", "--dll-dir", dest="DLL_DIR", type=str, help="Directory to find the DLLs" -) -parser.add_argument( - "-w", - "--wheel-dir", - dest="WHEEL_DIR", - type=str, - help=('Directory to store delocated wheels (default: "wheelhouse/")'), - default="wheelhouse/", -) - -args = parser.parse_args() - -wheel_name = args.WHEEL_FILE -print(wheel_name) -print(os.path.join(wheel_name, "opengate_core-*-win_amd64.whl")) -wheel_name = glob.glob(os.path.join(wheel_name, "opengate_core-*-win_amd64.whl"))[0] -print(wheel_name) -repaired_wheel = os.path.join( - os.path.abspath(args.WHEEL_DIR), os.path.basename(wheel_name) -) - -old_wheel_dir = tempfile.mkdtemp() -new_wheel_dir = tempfile.mkdtemp() -package_name = os.path.basename(wheel_name).split("-")[0] -bundle_name = package_name + ".libs" -bundle_path = os.path.join(new_wheel_dir, bundle_name) -os.makedirs(bundle_path) - -with zipfile.ZipFile(wheel_name, "r") as wheel: - wheel.extractall(old_wheel_dir) - wheel.extractall(new_wheel_dir) - pyd_rel_paths = [ - os.path.normpath(path) for path in wheel.namelist() if path.endswith(".pyd") - ] - -dll_dependencies = {} -for rel_path in pyd_rel_paths: - abs_path = os.path.join(old_wheel_dir, rel_path) - print(rel_path) - dll_dependencies.update(find_dll_dependencies(abs_path, args.DLL_DIR)) - -for dll, dependencies in dll_dependencies.items(): - mapping = {} - - print(dll) - print(dependencies) - - if dll.endswith(".pyd"): - rel_path = next(path for path in pyd_rel_paths if path.endswith(dll)) - - for dep in dependencies: - src_path = os.path.join(args.DLL_DIR, dep) - hashed_name = hash_filename(src_path) # already basename - new_path = os.path.join(bundle_path, hashed_name) - if dll.endswith(".pyd"): - bundle_rel_path = os.path.join( - "..\\" * rel_path.count(os.path.sep), bundle_name - ) - mapping[dep.encode("ascii")] = os.path.join( - bundle_rel_path, hashed_name - ).encode("ascii") - else: - mapping[dep.encode("ascii")] = hashed_name.encode("ascii") - if not os.path.exists(new_path): - shutil.copy2(src_path, new_path) - - if dll.endswith(".pyd"): - old_name = os.path.join(old_wheel_dir, rel_path) - new_name = os.path.join(new_wheel_dir, rel_path) - else: - old_name = os.path.join(args.DLL_DIR, dll) - hashed_name = hash_filename(old_name) # already basename - new_name = os.path.join(bundle_path, hashed_name) - - mangle_filename(old_name, new_name, mapping) - -pathlib.Path(os.path.dirname(repaired_wheel)).mkdir(parents=True, exist_ok=True) -with zipfile.ZipFile(repaired_wheel, "w", zipfile.ZIP_DEFLATED) as new_wheel: - for root, dirs, files in os.walk(new_wheel_dir): - new_root = os.path.relpath(root, new_wheel_dir) - for file in files: - new_wheel.write(os.path.join(root, file), os.path.join(new_root, file)) - -now = datetime.now() -print(now.strftime("%H:%M:%S")) -print("------------ End Delocate for Windows ----------") diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9404ca9dcd..97a27c8a74 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,7 +30,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-24.04] - python-version: ['3.10'] + python-version: ['3.14'] steps: - name: Checkout github repo uses: actions/checkout@v6 @@ -63,11 +63,6 @@ jobs: matrix: os: [ubuntu-24.04, macos-15, windows-2025] python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] - exclude: - - os: macos-15 - python-version: '3.10' - - os: windows-2025 - python-version: '3.10' steps: - name: Checkout github repo uses: actions/checkout@v6 @@ -96,13 +91,9 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-24.04-arm, macos-15-intel] + os: [ubuntu-24.04-arm, macos-15-intel, windows-11-arm] python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] exclude: - - os: macos-15 - python-version: '3.10' - - os: windows-2025 - python-version: '3.10' - os: macos-15-intel python-version: '3.14' steps: @@ -159,7 +150,7 @@ jobs: echo "release=${varOS}" >> $GITHUB_OUTPUT - name: Cache modules id: cache_opengate_core_dependencies - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: ~/software key: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_build @@ -259,7 +250,7 @@ jobs: # echo "release=${varOS:1}" >> $GITHUB_OUTPUT # - name: Cache modules # id: cache_opengate_core_dependencies -# uses: actions/cache@v4 +# uses: actions/cache@v5 # with: # path: ~/software # key: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_build @@ -287,11 +278,6 @@ jobs: matrix: os: [ubuntu-24.04, macos-15, windows-2025] python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] - exclude: - - os: macos-15 - python-version: '3.10' - - os: windows-2025 - python-version: '3.10' steps: - name: Checkout github repo uses: actions/checkout@v6 @@ -314,7 +300,7 @@ jobs: miniconda-version: "latest" auto-update-conda: true activate-environment: vega-altair - python-version: '3.10' + python-version: '3.14' - name: Merge the results shell: bash -el {0} run: | diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 923994e2a5..b48d8dfb64 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -5,7 +5,7 @@ # See LICENSE.md for further details # -------------------------------------------------- -cmake_minimum_required(VERSION 3.5.0) +cmake_minimum_required(VERSION 3.10.0) # remove warning about project version cmake_policy(SET CMP0048 NEW) diff --git a/core/VERSION b/core/VERSION new file mode 100644 index 0000000000..4149c39eec --- /dev/null +++ b/core/VERSION @@ -0,0 +1 @@ +10.1.0 diff --git a/core/setup.py b/core/setup.py index 81565cced1..753c9f026f 100755 --- a/core/setup.py +++ b/core/setup.py @@ -27,7 +27,7 @@ def get_base_dir() -> Path: return Path(__file__).parent.parent.resolve() -with open("../VERSION", "r") as fh: +with open("VERSION", "r") as fh: version = fh.read()[:-1] from distutils.version import LooseVersion From 470399359c8ab032399648d8d9302260c78cbd32 Mon Sep 17 00:00:00 2001 From: Alex Vergara Gil Date: Thu, 21 May 2026 09:20:25 +0200 Subject: [PATCH 2/8] copy VERSION in build stage --- .../workflows/actions_build/ci_build_wheel_macos.sh | 1 + .../workflows/actions_build/ci_build_wheel_ubuntu.sh | 1 + .../workflows/actions_build/ci_build_wheel_windows.sh | 1 + core/VERSION | 1 - core/setup.py | 10 ++++++++-- 5 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 core/VERSION diff --git a/.github/workflows/actions_build/ci_build_wheel_macos.sh b/.github/workflows/actions_build/ci_build_wheel_macos.sh index 1c20e5b58c..65f6fdc8c3 100755 --- a/.github/workflows/actions_build/ci_build_wheel_macos.sh +++ b/.github/workflows/actions_build/ci_build_wheel_macos.sh @@ -62,6 +62,7 @@ fi cd $GITHUB_WORKSPACE source $HOME/software/geant4/bin/geant4make.sh export CMAKE_PREFIX_PATH=$HOME/software/geant4/bin:$HOME/software/itk/bin/:${CMAKE_PREFIX_PATH} +cp VERSION core/VERSION cd core mkdir opengate_core/plugins diff --git a/.github/workflows/actions_build/ci_build_wheel_ubuntu.sh b/.github/workflows/actions_build/ci_build_wheel_ubuntu.sh index 8e84814e25..9bdd773ed7 100755 --- a/.github/workflows/actions_build/ci_build_wheel_ubuntu.sh +++ b/.github/workflows/actions_build/ci_build_wheel_ubuntu.sh @@ -48,6 +48,7 @@ LD_LIBRARY_PATH=/software/geant4/lib:/software/itk/lib ' # Run the build in custom docker +cp VERSION core/VERSION cd core python -m cibuildwheel --output-dir dist mkdir -p $GITHUB_WORKSPACE/dist diff --git a/.github/workflows/actions_build/ci_build_wheel_windows.sh b/.github/workflows/actions_build/ci_build_wheel_windows.sh index acac707f70..c61d0e16cf 100755 --- a/.github/workflows/actions_build/ci_build_wheel_windows.sh +++ b/.github/workflows/actions_build/ci_build_wheel_windows.sh @@ -52,6 +52,7 @@ fi cd $GITHUB_WORKSPACE source $HOME/software/geant4/bin/geant4make.sh export CMAKE_PREFIX_PATH=$HOME/software/geant4/bin:$HOME/software/itk/bin/:${CMAKE_PREFIX_PATH} +cp VERSION core/VERSION cd core if [[ ${MATRIX_PYTHON_VERSION} == "3.10" ]]; then export CIBW_BUILD="cp310-*" diff --git a/core/VERSION b/core/VERSION deleted file mode 100644 index 4149c39eec..0000000000 --- a/core/VERSION +++ /dev/null @@ -1 +0,0 @@ -10.1.0 diff --git a/core/setup.py b/core/setup.py index 753c9f026f..3d1628cf75 100755 --- a/core/setup.py +++ b/core/setup.py @@ -27,8 +27,14 @@ def get_base_dir() -> Path: return Path(__file__).parent.parent.resolve() -with open("VERSION", "r") as fh: - version = fh.read()[:-1] +try: + # For CI builds + with open("VERSION", "r") as fh: + version = fh.read()[:-1] +except IOError: + # For local builds + with open("../VERSION", "r") as fh: + version = fh.read()[:-1] from distutils.version import LooseVersion From cfa8c709842fc18f90f384f1733eb78f5d10a3fc Mon Sep 17 00:00:00 2001 From: Thomas BAUDIER Date: Thu, 21 May 2026 16:28:13 +0200 Subject: [PATCH 3/8] Commit to remove Remove condition to be able to run CI for all OS Allow us to try the vizu with the new ci --- .github/workflows/main.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 97a27c8a74..eafa20f1e4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -86,7 +86,6 @@ jobs: path: dist/ build_opengate_core_wheel_ci_or_tag: - if: (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) || (github.event_name == 'schedule') runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -119,7 +118,6 @@ jobs: path: dist/ build_opengate_core_novis_wheel: - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') runs-on: ${{ matrix.os }} strategy: fail-fast: false From 9d5d5f3c1c68ddbd14601dd971833db926313438 Mon Sep 17 00:00:00 2001 From: Alex Vergara Gil Date: Fri, 22 May 2026 15:03:10 +0200 Subject: [PATCH 4/8] use python 3.13 as 3.14 is not supported in some OS --- .github/workflows/actions_build/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actions_build/action.yml b/.github/workflows/actions_build/action.yml index 36bd3f3fe2..8a4fe1c2cd 100755 --- a/.github/workflows/actions_build/action.yml +++ b/.github/workflows/actions_build/action.yml @@ -56,7 +56,7 @@ runs: miniconda-version: "latest" auto-update-conda: true activate-environment: opengate_core - python-version: '3.14' + python-version: '3.13' - name: Set up Homebrew if: (inputs.os == 'macos-15') || (inputs.os == 'macos-15-intel') id: set-up-homebrew From 9cebb7d262664019e399838d50c78a99e4a3bb25 Mon Sep 17 00:00:00 2001 From: Alex Vergara Gil Date: Mon, 25 May 2026 09:11:10 +0200 Subject: [PATCH 5/8] fix macos 15 intel not seeing qt and bad conda version in windows 11 arm --- .github/workflows/actions_build/action.yml | 26 +++++++++---------- .../actions_build/ci_build_wheel_macos.sh | 24 ++++++++++------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/.github/workflows/actions_build/action.yml b/.github/workflows/actions_build/action.yml index 8a4fe1c2cd..92af872ca2 100755 --- a/.github/workflows/actions_build/action.yml +++ b/.github/workflows/actions_build/action.yml @@ -50,26 +50,27 @@ runs: path: ~/software key: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_build restore-keys: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_build - - uses: conda-incubator/setup-miniconda@v3 - if: (inputs.os == 'macos-15') || (inputs.os == 'macos-15-intel') || (inputs.os == 'windows-2025') || (inputs.os == 'windows-11-arm') + - name: Miniconda setup Macos and windows + if: (inputs.os == 'macos-15') || (inputs.os == 'windows-2025') + uses: conda-incubator/setup-miniconda@v3 with: miniconda-version: "latest" auto-update-conda: true activate-environment: opengate_core - python-version: '3.13' + python-version: '3.14' + - name: Miniconda setup Macos intel and windows arm + if: (inputs.os == 'macos-15-intel') || (inputs.os == 'windows-11-arm') + uses: conda-incubator/setup-miniconda@v3 + with: + miniconda-version: "latest" + auto-update-conda: true + activate-environment: opengate_core + python-version: '3.12' - name: Set up Homebrew if: (inputs.os == 'macos-15') || (inputs.os == 'macos-15-intel') id: set-up-homebrew uses: Homebrew/actions/setup-homebrew@main - # - name: Cache Homebrew prefix - # if: (inputs.os == 'macos-15') || (inputs.os == 'macos-15-intel') - # id: cache-homebrew - # uses: Homebrew/actions/cache-homebrew-prefix@main - # with: - # install: wget ccache fftw libomp qt xerces-c cmake - # uninstall: true - # workflow-key: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_homebrew - - name: Create opengate_core Wheel Linux + - name: Create opengate_core Wheel Linux if: (inputs.os == 'ubuntu-24.04') || (inputs.os == 'ubuntu-24.04-arm') env: MATRIX_OS: ${{ inputs.os }} @@ -84,7 +85,6 @@ runs: MATRIX_OS: ${{ inputs.os }} MATRIX_PYTHON_VERSION: ${{ inputs.python-version }} MATRIX_CACHE: ${{ steps.cache_opengate_core_dependencies.outputs.cache-hit }} - # BREW_CACHE: ${{ steps.cache_homebrew.outputs.cache-hit }} shell: bash -l {0} run: | export > $GITHUB_WORKSPACE/env_dump.txt diff --git a/.github/workflows/actions_build/ci_build_wheel_macos.sh b/.github/workflows/actions_build/ci_build_wheel_macos.sh index 65f6fdc8c3..8f7737211d 100755 --- a/.github/workflows/actions_build/ci_build_wheel_macos.sh +++ b/.github/workflows/actions_build/ci_build_wheel_macos.sh @@ -3,23 +3,27 @@ set -e source $GITHUB_WORKSPACE/env_dump.txt -if [ "${BREW_CACHE}" != 'true' ]; then - brew install --force --verbose --overwrite \ - ccache \ - fftw \ - libomp \ - qt \ - xerces-c || true +brew install --force --verbose --overwrite \ + ccache \ + fftw \ + libomp \ + xerces-c || true - brew uninstall --ignore-dependencies libxext - brew uninstall --ignore-dependencies libx11 -fi +brew uninstall --ignore-dependencies libxext +brew uninstall --ignore-dependencies libx11 export LDFLAGS="-L/usr/local/opt/llvm/lib" export CPPFLAGS="-I/usr/local/opt/llvm/include -fopenmp" conda info conda list export PATH="/usr/local/miniconda/envs/opengate_core/bin/:$PATH" + +if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then + conda install conda-forge::qt6-main conda-forge::qt6-3d +else + brew install qt +fi + export QT_PLUGIN_DIR=$(qtpaths6 --plugin-dir) echo "QT_PLUGIN_DIR is $QT_PLUGIN_DIR" pip install wget colored setuptools From fcdafe1445ae0f8592b90be9ed7df1635435b73b Mon Sep 17 00:00:00 2001 From: Alex Vergara Gil Date: Mon, 25 May 2026 09:30:23 +0200 Subject: [PATCH 6/8] fix wrong indentation --- .github/workflows/actions_build/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actions_build/action.yml b/.github/workflows/actions_build/action.yml index 92af872ca2..f076f6461b 100755 --- a/.github/workflows/actions_build/action.yml +++ b/.github/workflows/actions_build/action.yml @@ -70,7 +70,7 @@ runs: if: (inputs.os == 'macos-15') || (inputs.os == 'macos-15-intel') id: set-up-homebrew uses: Homebrew/actions/setup-homebrew@main - - name: Create opengate_core Wheel Linux + - name: Create opengate_core Wheel Linux if: (inputs.os == 'ubuntu-24.04') || (inputs.os == 'ubuntu-24.04-arm') env: MATRIX_OS: ${{ inputs.os }} From 51dd3397bca86dede11f69a2c5cb4ace5cd942b9 Mon Sep 17 00:00:00 2001 From: Alex Vergara Gil Date: Mon, 25 May 2026 10:01:14 +0200 Subject: [PATCH 7/8] fix wrong conda path in macos and let miniconda choose the version for macos intel and windows arm --- .github/workflows/actions_build/action.yml | 8 ++++---- .github/workflows/actions_build/ci_build_wheel_macos.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/actions_build/action.yml b/.github/workflows/actions_build/action.yml index f076f6461b..526e61f810 100755 --- a/.github/workflows/actions_build/action.yml +++ b/.github/workflows/actions_build/action.yml @@ -52,7 +52,7 @@ runs: restore-keys: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_build - name: Miniconda setup Macos and windows if: (inputs.os == 'macos-15') || (inputs.os == 'windows-2025') - uses: conda-incubator/setup-miniconda@v3 + uses: conda-incubator/setup-miniconda@v4 with: miniconda-version: "latest" auto-update-conda: true @@ -60,12 +60,12 @@ runs: python-version: '3.14' - name: Miniconda setup Macos intel and windows arm if: (inputs.os == 'macos-15-intel') || (inputs.os == 'windows-11-arm') - uses: conda-incubator/setup-miniconda@v3 + uses: conda-incubator/setup-miniconda@v4 with: - miniconda-version: "latest" + # miniconda-version: "latest" auto-update-conda: true activate-environment: opengate_core - python-version: '3.12' + python-version: '3.13' - name: Set up Homebrew if: (inputs.os == 'macos-15') || (inputs.os == 'macos-15-intel') id: set-up-homebrew diff --git a/.github/workflows/actions_build/ci_build_wheel_macos.sh b/.github/workflows/actions_build/ci_build_wheel_macos.sh index 8f7737211d..fd51df3c7a 100755 --- a/.github/workflows/actions_build/ci_build_wheel_macos.sh +++ b/.github/workflows/actions_build/ci_build_wheel_macos.sh @@ -16,7 +16,7 @@ export LDFLAGS="-L/usr/local/opt/llvm/lib" export CPPFLAGS="-I/usr/local/opt/llvm/include -fopenmp" conda info conda list -export PATH="/usr/local/miniconda/envs/opengate_core/bin/:$PATH" +export PATH="/Users/runner/miniconda3/envs/opengate_core/bin/:$PATH" if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then conda install conda-forge::qt6-main conda-forge::qt6-3d From 594bad528c9e8ddb5e1028bded3e05afe6201b55 Mon Sep 17 00:00:00 2001 From: Alex Vergara Gil Date: Mon, 25 May 2026 10:19:37 +0200 Subject: [PATCH 8/8] drop windows 11 arm support: not supported by conda and no easy way to install requirements --- .github/workflows/actions_build/action.yml | 4 ++-- .github/workflows/actions_build/ci_build_wheel_macos.sh | 3 ++- .github/workflows/main.yml | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/actions_build/action.yml b/.github/workflows/actions_build/action.yml index 526e61f810..db3d4cea12 100755 --- a/.github/workflows/actions_build/action.yml +++ b/.github/workflows/actions_build/action.yml @@ -59,10 +59,10 @@ runs: activate-environment: opengate_core python-version: '3.14' - name: Miniconda setup Macos intel and windows arm - if: (inputs.os == 'macos-15-intel') || (inputs.os == 'windows-11-arm') + if: (inputs.os == 'macos-15-intel') uses: conda-incubator/setup-miniconda@v4 with: - # miniconda-version: "latest" + miniconda-version: "latest" auto-update-conda: true activate-environment: opengate_core python-version: '3.13' diff --git a/.github/workflows/actions_build/ci_build_wheel_macos.sh b/.github/workflows/actions_build/ci_build_wheel_macos.sh index fd51df3c7a..b30b3c3a9c 100755 --- a/.github/workflows/actions_build/ci_build_wheel_macos.sh +++ b/.github/workflows/actions_build/ci_build_wheel_macos.sh @@ -20,11 +20,12 @@ export PATH="/Users/runner/miniconda3/envs/opengate_core/bin/:$PATH" if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then conda install conda-forge::qt6-main conda-forge::qt6-3d + export QT_PLUGIN_DIR="/Users/runner/miniconda3/envs/opengate_core/lib/qt6/plugins" else brew install qt + export QT_PLUGIN_DIR=$(qtpaths6 --plugin-dir) fi -export QT_PLUGIN_DIR=$(qtpaths6 --plugin-dir) echo "QT_PLUGIN_DIR is $QT_PLUGIN_DIR" pip install wget colored setuptools # install cibuildwheel diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eafa20f1e4..278d57d22b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -90,7 +90,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-24.04-arm, macos-15-intel, windows-11-arm] + os: [ubuntu-24.04-arm, macos-15-intel] python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] exclude: - os: macos-15-intel