From 9ae8b56fec07e62c8e71b52915fb89f3b3fdd5e1 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Thu, 7 May 2026 15:00:27 +0100 Subject: [PATCH 1/6] CI: bump workflow actions --- .github/workflows/build.yml | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35c44d989..bd5a476f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: python-version: [3.11] numpy-version: [1.25] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: {fetch-depth: 0, submodules: recursive} - id: reqs name: set requirements @@ -38,7 +38,7 @@ jobs: envname="${GITHUB_REPOSITORY##*/}-${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}" echo "envname=$envname" >> $GITHUB_OUTPUT sed -ri -e 's/^(name: ).*/\1$envname/' -e '/ python /d' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' scripts/cil_development.yml - - uses: conda-incubator/setup-miniconda@v3 + - uses: conda-incubator/setup-miniconda@v4 with: python-version: ${{ matrix.python-version }} environment-file: scripts/cil_development.yml @@ -69,11 +69,11 @@ jobs: - {python-version: '3.10', numpy-version: 1.23} - {python-version: 3.12, numpy-version: 1.26} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: {fetch-depth: 0, submodules: recursive} - name: set requirements run: sed -ri -e '/ python /d' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' -e 's/cuda*//' -e '/tigre/d' scripts/cil_development.yml - - uses: conda-incubator/setup-miniconda@v3 + - uses: conda-incubator/setup-miniconda@v4 with: python-version: ${{ matrix.python-version }} environment-file: scripts/cil_development.yml @@ -125,7 +125,7 @@ jobs: os: ${{ fromJson(needs.conda-matrix.outputs.os) }} include: ${{ fromJson(needs.conda-matrix.outputs.include) }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 submodules: recursive @@ -158,15 +158,15 @@ jobs: os: ${{ fromJson(needs.conda-matrix.outputs.os) }} include: ${{ fromJson(needs.conda-matrix.outputs.include-numpy) }} steps: - - uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v3 + - uses: actions/checkout@v6 + - uses: conda-incubator/setup-miniconda@v4 with: python-version: ${{ matrix.python-version }} mamba-version: "*" channels: conda-forge conda-remove-defaults: "true" - run: conda install conda-build - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v8 with: name: cil-py${{ matrix.python-version }}-${{ matrix.os }} path: dist @@ -180,13 +180,13 @@ jobs: runs-on: ubuntu-latest needs: conda-test steps: - - uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v3 + - uses: actions/checkout@v6 + - uses: conda-incubator/setup-miniconda@v4 with: mamba-version: "*" channels: conda-forge conda-remove-defaults: "true" - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v8 with: {pattern: cil-py*-*, path: dist, merge-multiple: true} - run: mamba install anaconda-client - name: anaconda upload -c ccpi @@ -205,12 +205,12 @@ jobs: defaults: {run: {shell: 'bash -el {0}', working-directory: docs}} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 submodules: recursive ref: ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA - - uses: conda-incubator/setup-miniconda@v3 + - uses: conda-incubator/setup-miniconda@v4 with: python-version: 3.12 mamba-version: "*" @@ -230,12 +230,12 @@ jobs: conda list - run: pip install .. - name: checkout docs - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: path: docs/build ref: gh-pages - id: pages - uses: actions/configure-pages@v5 + uses: actions/configure-pages@v6 - name: update web pages (jekyll) run: make JEKYLLOPTS="--baseurl ${{ steps.pages.outputs.base_path }}" web-deps web env: {JEKYLL_ENV: production} @@ -245,7 +245,7 @@ jobs: docs_dir="${docs_dir//\//_}" if test "$docs_dir" = master; then docs_dir=nightly; fi make BUILDSUBDIR="$docs_dir" dirhtml - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: DocumentationHTML path: docs/build @@ -263,7 +263,7 @@ jobs: contents: read packages: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 submodules: recursive @@ -272,8 +272,8 @@ jobs: with: docker-images: false large-packages: false - - uses: docker/setup-buildx-action@v3 - - uses: docker/metadata-action@v5 + - uses: docker/setup-buildx-action@v4 + - uses: docker/metadata-action@v6 id: meta with: images: ghcr.io/${{ github.repository }} @@ -283,13 +283,13 @@ jobs: type=semver,pattern={{major}}.{{minor}} labels: | org.opencontainers.image.licenses=Apache-2.0 AND BSD-3-Clause AND GPL-3.0 - - uses: docker/login-action@v3 + - uses: docker/login-action@v4 if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/build-push-action@v6 + - uses: docker/build-push-action@v7 with: cache-from: type=gha cache-to: type=gha,mode=max @@ -300,7 +300,7 @@ jobs: run: > docker run --rm -v .:/CIL tomographicimaging/cil:test /bin/bash -c 'python -m unittest discover -v /CIL/Wrappers/Python/test' - - uses: docker/build-push-action@v6 + - uses: docker/build-push-action@v7 with: cache-from: type=gha cache-to: type=gha,mode=max From f9f992df7a2380ce95bdbaf5f4d24c1ea92901c7 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Thu, 7 May 2026 14:58:14 +0100 Subject: [PATCH 2/6] migrate to rattler-build - follow-up to #2320 --- .github/workflows/README.md | 8 +-- .github/workflows/build.yml | 51 +++++----------- .gitignore | 1 + CHANGELOG.md | 2 + recipe.yaml | 113 ++++++++++++++++++++++++++++++++++++ recipe/bld.bat | 8 --- recipe/build.sh | 16 ----- recipe/meta.yaml | 78 ------------------------- 8 files changed, 136 insertions(+), 141 deletions(-) create mode 100644 recipe.yaml delete mode 100644 recipe/bld.bat delete mode 100755 recipe/build.sh delete mode 100644 recipe/meta.yaml diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 8e8080dc3..2f4bf3cc3 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -12,7 +12,7 @@ The jobs are: + uses default (GitHub-hosted) runners to run tests on the min & max supported Python & NumPy versions + `python -m unittest discover -v ./Wrappers/Python/test` - `conda` - + uses `conda-build` to build the conda package (saved as a build artifact named `cil-py3.m-OS`) + + uses `rattler-build` to build the conda package (saved as a build artifact named `conda-py3.m-OS`) - `docs` + uses `docs/docs_environment.yml` plus `make -C docs` to build the documentation (saved as a build artifact named `DocumentationHTML`) + renders to the `gh-pages` branch on `master` (nightly) pushes or on tag (release) pushes @@ -39,12 +39,12 @@ When opening or modifying a pull request to `master`, two variants are built and > [!NOTE] > The action publishes `ccpi` as well as `https://tomography.stfc.ac.uk/conda/` conda channels. We will eventually move to conda-forge instead. -It looks for conda-build dependencies in the channels listed [here](./build.yml#L118). If you add any new dependencies, the appropriate channels need to be added to this line. +It looks for dependencies in the channels listed in the `rattler-build-action`'s `build-args` [here](./build.yml). If you add any new dependencies, the appropriate channels need to be added to this line. > [!TIP] -> The `conda` job builds the `*.tar.bz2` package and uploads it as an artifact called `cil-py3.m-OS`. +> The `conda` job builds the `*.conda` package and uploads it as an artifact called `conda-py3.m-OS`. > It can be found by going to the "Actions" tab, and selecting the appropriate run of `.github/workflows/build.yml`, or by clicking on the tick on the action in the "All checks have passed/failed" section of a PR. When viewing the "Summary" for the run of the action, there is an "Artifact" section at the bottom of the page. -> Clicking on `cil-py3.m-OS` allows you to download a zip folder containing the `*.tar.bz2` file. +> Clicking on `conda-py3.m-OS` allows you to download a zip folder containing the `*.conda` file. ### docs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd5a476f4..7f53bd489 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,7 +87,6 @@ jobs: python-version: ${{ steps.matrix.outputs.python-version }} numpy-version: ${{ steps.matrix.outputs.numpy-version }} os: ${{ steps.matrix.outputs.os }} - include: ${{ steps.matrix.outputs.include }} include-numpy: ${{ steps.matrix.outputs.include-numpy }} steps: - id: matrix @@ -109,21 +108,16 @@ jobs: fi fi if $include_max; then - echo "include=[{'python-version': 3.12, 'os': 'ubuntu'}, {'python-version': 3.12, 'os': 'windows'}]" >> $GITHUB_OUTPUT echo "include-numpy=[{'python-version': 3.12, 'numpy-version': 1.26, 'os': 'ubuntu'}, {'python-version': 3.12, 'numpy-version': 1.26, 'os': 'windows'}]" >> $GITHUB_OUTPUT else - echo "include=[]" >> $GITHUB_OUTPUT echo "include-numpy=[]" >> $GITHUB_OUTPUT fi conda-build: - defaults: {run: {shell: 'bash -el {0}'}} runs-on: ${{ matrix.os }}-${{ matrix.os == 'ubuntu' && '24.04' || '2022' }} needs: conda-matrix strategy: matrix: - python-version: ${{ fromJson(needs.conda-matrix.outputs.python-version) }} os: ${{ fromJson(needs.conda-matrix.outputs.os) }} - include: ${{ fromJson(needs.conda-matrix.outputs.include) }} steps: - uses: actions/checkout@v6 with: @@ -132,21 +126,11 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA - if: matrix.os == 'windows' uses: ilammy/msvc-dev-cmd@v1 - - uses: conda-incubator/setup-miniconda@v3 - with: - python-version: ${{ matrix.python-version }} - mamba-version: "*" - channels: conda-forge - conda-remove-defaults: "true" - - run: conda install conda-build - - name: conda build - run: > - conda build -c conda-forge -c https://software.repos.intel.com/python/conda -c ccpi --override-channels --python=${{ matrix.python-version }} - --no-test --output-folder dist recipe - - uses: actions/upload-artifact@v4 + - uses: prefix-dev/rattler-build-action@v0.2.37 with: - name: cil-py${{ matrix.python-version }}-${{ matrix.os }} - path: dist/*/cil-* + recipe-path: recipe.yaml + build-args: --experimental -c conda-forge -c https://software.repos.intel.com/python/conda -c ccpi --no-test + artifact-name: conda-${{ matrix.os }} conda-test: defaults: {run: {shell: 'bash -el {0}'}} runs-on: ${{ matrix.os }}-${{ matrix.os == 'ubuntu' && '24.04' || '2022' }} @@ -168,37 +152,34 @@ jobs: - run: conda install conda-build - uses: actions/download-artifact@v8 with: - name: cil-py${{ matrix.python-version }}-${{ matrix.os }} - path: dist + name: conda-${{ matrix.os }} + path: output - name: conda test run: > conda build -c conda-forge -c https://software.repos.intel.com/python/conda -c ccpi --override-channels --python=${{ matrix.python-version }} - --test dist/*/cil-* --extra-deps numpy=${{ matrix.numpy-version }} + --test output/*/cil-* --extra-deps numpy=${{ matrix.numpy-version }} conda-upload: if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') - defaults: {run: {shell: 'bash -el {0}', working-directory: dist}} + defaults: {run: {shell: 'bash -el {0}', working-directory: output}} runs-on: ubuntu-latest needs: conda-test steps: - uses: actions/checkout@v6 - - uses: conda-incubator/setup-miniconda@v4 - with: - mamba-version: "*" - channels: conda-forge - conda-remove-defaults: "true" + - uses: prefix-dev/rattler-build-action@v0.2.37 + with: {setup-only: true} - uses: actions/download-artifact@v8 - with: {pattern: cil-py*-*, path: dist, merge-multiple: true} - - run: mamba install anaconda-client - - name: anaconda upload -c ccpi + with: {pattern: conda-*, path: output, merge-multiple: true} + - name: conda upload -c ccpi run: > - anaconda -v -t ${{ secrets.CCPI_CONDA_TOKEN }} upload --force - --label ${{ startsWith(github.ref, 'refs/tags') && 'main' || 'dev' }} */cil-* + rattler-build upload anaconda */*.conda -f + -o ccpi -a ${{ secrets.CCPI_CONDA_TOKEN }} + -c ${{ startsWith(github.ref, 'refs/tags') && 'main' || 'dev' }} - if: startsWith(github.ref, 'refs/tags') name: conda upload -c tomography.stfc.ac.uk/conda run: | echo '${{ secrets.STFC_SSH_KEY }}' > ./key chmod 600 ./key - rsync -e 'ssh -o StrictHostKeyChecking=no -i ./key' -R */cil-* '${{ secrets.STFC_SSH_HOST }}:${{ secrets.STFC_SSH_CONDA_DIR }}' + rsync -e 'ssh -o StrictHostKeyChecking=no -i ./key' -R */*.conda '${{ secrets.STFC_SSH_HOST }}:${{ secrets.STFC_SSH_CONDA_DIR }}' ssh -o StrictHostKeyChecking=no -i ./key ${{ secrets.STFC_SSH_HOST }} \ 'bash -lic "conda index --bz2 --zst --run-exports --channeldata --rss -n ccpi ${{ secrets.STFC_SSH_CONDA_DIR }}"' docs: diff --git a/.gitignore b/.gitignore index 755ad9fd9..6823c1cf5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /build* +/output/ __pycache__/ /Wrappers/Python/cil-*.dist-info/ /Wrappers/Python/cil/include/ diff --git a/CHANGELOG.md b/CHANGELOG.md index bc213eccd..ace85d0e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ - Add prefix argument to TIFFStackReader to load a subset of TIFF files in a folder (#2239) - Update ASTRA interface to `direct_FP3D/BP3D` removing copies for GPU `ProjectionOperator` calls (#2134) + - Testing: + - migrate from `conda build` to `rattler-build` * 25.0.0 - New features: diff --git a/recipe.yaml b/recipe.yaml new file mode 100644 index 000000000..be805de36 --- /dev/null +++ b/recipe.yaml @@ -0,0 +1,113 @@ +schema_version: 1 + +context: + name: ${{ load_from_file("pyproject.toml").project.name }} # ratter-build --experimental + python_min: ${{ load_from_file("pyproject.toml")['project']['requires-python'] | replace(">=", "") }} # ratter-build --experimental + build_number: 0 + version: ${{ git.latest_tag(".") | replace("v", "") }} # .dev${{ build_number }}+g${{ git.head_rev(".") }} # ratter-build --experimental + test_gpu: ${{ env.get("TESTS_FORCE_GPU", default="") | bool }} + # used multiple times, so defined once here to avoid repetition + ipp_version: '2021.12.*' + astra_version: '2.1.*' + +package: + name: ${{ name }} + version: ${{ version }} + +source: + path: . + +build: + number: ${{ build_number }} + noarch: python + script: + content: + - if: win + then: pip install . -vv --prefix=%PREFIX% + - if: osx + then: pip install . -vv --prefix=$PREFIX -Ccmake.args="-DOPENMP_LIBRARIES=${CONDA_PREFIX}/lib -DOPENMP_INCLUDES=${CONDA_PREFIX}/include" + - if: linux + then: pip install . -vv --prefix=$PREFIX + env: + CMAKE_BUILD_TYPE: Release + CMAKE_GENERATOR: Ninja + +requirements: + build: + - cmake >=3.16 + - ninja + - ${{ compiler('cxx') }} + host: + - if: linux + then: libgomp + - if: osx + then: llvm-openmp + - if: x86_64 + then: + - ipp-include ${{ ipp_version }} + - ipp-devel ${{ ipp_version }} + - python ${{ python_min ~ '.*' }} + - pip + - setuptools >=64 + - setuptools_scm >=8 + - scikit-build-core >=0.10 + run: + - python >=${{ python_min }} + - if: x86_64 + then: ipp ${{ ipp_version }} + - numpy >=1.23,<2 + - scipy >=1.4 + - h5py + - pillow + - pywavelets + - cil-data >=22 + - tqdm + - numba + # version constraints of optional dependencies + run_constraints: + - tomophantom >=3.0.3 + - astra-toolbox >=1.9.9.dev5 + - tigre >=2.4 + - ccpi-regulariser >=24.0.1 + - olefile >=0.46 + - zenodo_get >=1.6 + +tests: + - python: + imports: + - cil + - cil.framework + - cil.version + pip_check: false + python_version: ["${{ python_min ~ '.*' }}", "3.*"] + - script: + - pip install unittest-parametrize + - python -m unittest discover -v -s Wrappers/Python/test + files: + source: + - ./Wrappers/Python/test + requirements: + run: + - pip + - python-wget + - if: linux + then: cvxpy !=1.8.2 + - scikit-image + - packaging + - tomophantom 3.0.3.* + - if: not osx + then: ccpi-regulariser 24.0.1.* + - if: test_gpu + then: + - tigre 2.6.* + - astra-toolbox ${{ astra_version }} cuda* + else: astra-toolbox ${{ astra_version }} py* + - matplotlib-base >=3.3 + - zenodo_get >=1.6 + - dxchange >=0.2.1 + - olefile >=0.46 + +about: + license: Apache-2.0 + summary: CCPi Core Imaging Library + homepage: https://TomographicImaging.github.io/CIL diff --git a/recipe/bld.bat b/recipe/bld.bat deleted file mode 100644 index 97fb90517..000000000 --- a/recipe/bld.bat +++ /dev/null @@ -1,8 +0,0 @@ -ROBOCOPY /E "%RECIPE_DIR%\.." "%SRC_DIR%" /XD .git /XD Wrappers\Python\build - -set SETUPTOOLS_SCM_PRETEND_VERSION_FOR_CIL=%PKG_VERSION% -if not "%GIT_DESCRIBE_NUMBER%"=="0" ( - set SETUPTOOLS_SCM_PRETEND_VERSION_FOR_CIL=%PKG_VERSION%.dev%GIT_DESCRIBE_NUMBER%+%GIT_DESCRIBE_HASH% -) -pip install . --no-deps -if errorlevel 1 exit 1 diff --git a/recipe/build.sh b/recipe/build.sh deleted file mode 100755 index 93f548655..000000000 --- a/recipe/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -set -euxo pipefail - -extra_args="-G Ninja" -if test $(python -c "from __future__ import print_function; import platform; print(platform.system())") = Darwin ; then - echo "Darwin" - extra_args="$extra_args -DOPENMP_LIBRARIES=${CONDA_PREFIX}/lib -DOPENMP_INCLUDES=${CONDA_PREFIX}/include" -else - echo "Not Darwin" -fi - -export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_CIL="${PKG_VERSION}" -if test "${GIT_DESCRIBE_NUMBER}" != "0"; then - export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_CIL="${PKG_VERSION}.dev${GIT_DESCRIBE_NUMBER}+${GIT_DESCRIBE_HASH}" -fi -pip install . --no-deps -Ccmake.args="${extra_args}" diff --git a/recipe/meta.yaml b/recipe/meta.yaml deleted file mode 100644 index 1845868dc..000000000 --- a/recipe/meta.yaml +++ /dev/null @@ -1,78 +0,0 @@ -package: - name: cil - version: {{ environ.get('GIT_DESCRIBE_TAG','v')[1:].split('-')[0] }} - -source: - path: .. - -build: - preserve_egg_dir: False - number: {{ GIT_DESCRIBE_NUMBER }} - -test: - requires: - - pip - - python-wget - - cvxpy!=1.8.2 # [linux] - - scikit-image - - tomophantom 3.0.3 - - tigre 2.6 - - packaging - - ccpi-regulariser 24.0.1 # [not osx] - - astra-toolbox 2.1 {{ 'cuda*' if environ.get('TESTS_FORCE_GPU', '') else 'py*' }} - - matplotlib-base >=3.3 - - zenodo_get >=1.6 - - dxchange >= 0.2.1 - - olefile >=0.46 - - source_files: - - ./Wrappers/Python/test - - commands: - - pip install unittest-parametrize - - python -m unittest discover -v -s Wrappers/Python/test - -{% set ipp_version = '2021.12' %} - -requirements: - build: - - cmake >=3.16 - - ninja - - {{ compiler('cxx') }} - - host: - - libgomp # [linux] - - llvm-openmp # [osx] - - ipp-include {{ ipp_version }} - - ipp-devel {{ ipp_version }} - - python x.x - - pip - - setuptools >=64 - - setuptools_scm >=8 - - scikit-build-core >=0.10 - - run: - - {{ pin_compatible('python', min_pin='x.x') }} - - ipp {{ ipp_version }} - - numpy >=1.23,<2 - - scipy >=1.4 - - h5py - - pillow - - pywavelets - - cil-data >=22 - - tqdm - - numba - - # version constraints of optional dependencies - run_constrained: - - tomophantom >=3.0.3 - - astra-toolbox >=1.9.9.dev5 - - tigre >=2.4 - - ccpi-regulariser >=24.0.1 - - olefile >=0.46 - - zenodo_get >=1.6 - -about: - home: https://TomographicImaging.github.io/CIL - license: Apache 2.0 License - summary: 'CCPi Core Imaging Library' From db60f2288ee7772095252f0a934647de39373efa Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Thu, 7 May 2026 16:30:13 +0100 Subject: [PATCH 3/6] build: fix dependenies - fixes #2209 --- CHANGELOG.md | 3 ++- pyproject.toml | 5 ++--- recipe.yaml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ace85d0e6..35200f143 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,8 @@ - Fixed behaviour of `ZeissDataReader` when negative values are passed in the ROI (#2244) - Fix `show2D` truncating plots when count is not a multiple of `num_cols` (#2315) - Dependencies: - - olefile and dxchange are optional dependencies, instead of required (#2209) + - `olefile` and `dxchange` are optional dependencies, instead of required (#2209, #2321) + - fix missing `packaging` required dependency (#2321) - dxchange minimum version set to 0.2.1 to fix #2256 (#2268) - improve `tqdm` notebook support (#2241) - cvxpy version set to !=1.8.2 to fix #2303 (#2306) diff --git a/pyproject.toml b/pyproject.toml index 6a811758f..d06683005 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,12 +42,10 @@ readme = "README.md" keywords = ["tomography", "optimisation"] dependencies = [ #"cil-data>=22", # missing from PyPI - "dxchange>=0.2.1", # Minimal release for OLE dtype fix: https://github.com/data-exchange/dxchange/pull/124#issue-3828961474 "h5py", #"ipp==2021.12.*", # PyPI conflicts with conda package "numba", "numpy>=1.23, <2.0.0", - "olefile>=0.46", "pillow", "pywavelets", "scipy>=1.4.0", @@ -57,6 +55,8 @@ dependencies = [ [project.optional-dependencies] plugins = [ "ipywidgets", + "dxchange>=0.2.1", + "olefile>=0.46", #"tomophantom==2.0.0", # [linux] # missing from PyPI ] gpu = [ @@ -68,7 +68,6 @@ test = [ #"ccpi-regulariser=24.0.1", # [not osx] # missing from PyPI "cvxpy", "matplotlib-base>=3.3", - "packaging", "scikit-image", "unittest-parametrize", "wget", diff --git a/recipe.yaml b/recipe.yaml index be805de36..db40f657b 100644 --- a/recipe.yaml +++ b/recipe.yaml @@ -53,6 +53,7 @@ requirements: - scikit-build-core >=0.10 run: - python >=${{ python_min }} + - packaging - if: x86_64 then: ipp ${{ ipp_version }} - numpy >=1.23,<2 @@ -93,7 +94,6 @@ tests: - if: linux then: cvxpy !=1.8.2 - scikit-image - - packaging - tomophantom 3.0.3.* - if: not osx then: ccpi-regulariser 24.0.1.* From 83796a73d4d04bac438f31c0245b454c340a04d0 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Thu, 7 May 2026 16:48:02 +0100 Subject: [PATCH 4/6] CI: native test matrix --- .github/workflows/build.yml | 107 +++++++++++++++--------------------- recipe.yaml | 8 +-- 2 files changed, 45 insertions(+), 70 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f53bd489..706ef6c7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,34 +60,14 @@ jobs: sed -i '/${{ steps.reqs.outputs.envname }}/d' ~/.profile source ~/.profile conda env remove -n "${{ steps.reqs.outputs.envname }}" - test: - defaults: {run: {shell: 'bash -el {0}'}} - runs-on: ubuntu-latest - strategy: - matrix: - include: - - {python-version: '3.10', numpy-version: 1.23} - - {python-version: 3.12, numpy-version: 1.26} - steps: - - uses: actions/checkout@v6 - with: {fetch-depth: 0, submodules: recursive} - - name: set requirements - run: sed -ri -e '/ python /d' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' -e 's/cuda*//' -e '/tigre/d' scripts/cil_development.yml - - uses: conda-incubator/setup-miniconda@v4 - with: - python-version: ${{ matrix.python-version }} - environment-file: scripts/cil_development.yml - activate-environment: cil_dev - - run: pip install . - - name: test - run: python -m unittest discover -v ./Wrappers/Python/test - conda-matrix: - runs-on: ubuntu-latest + test-matrix: + runs-on: ubuntu-slim outputs: python-version: ${{ steps.matrix.outputs.python-version }} numpy-version: ${{ steps.matrix.outputs.numpy-version }} os: ${{ steps.matrix.outputs.os }} - include-numpy: ${{ steps.matrix.outputs.include-numpy }} + include: ${{ steps.matrix.outputs.include }} + conda-include: ${{ steps.matrix.outputs.conda-include }} steps: - id: matrix run: | @@ -108,16 +88,42 @@ jobs: fi fi if $include_max; then - echo "include-numpy=[{'python-version': 3.12, 'numpy-version': 1.26, 'os': 'ubuntu'}, {'python-version': 3.12, 'numpy-version': 1.26, 'os': 'windows'}]" >> $GITHUB_OUTPUT + echo "include=[{'os': 'ubuntu', 'python-version': 3.12, 'numpy-version': 1.26}, {'os': 'windows', 'python-version': 3.12, 'numpy-version': 1.26}]" >> $GITHUB_OUTPUT + echo "conda-include=[{'os': 'ubuntu', 'python-version': 3.12}, {'os': 'windows', 'python-version': 3.12}]" >> $GITHUB_OUTPUT else - echo "include-numpy=[]" >> $GITHUB_OUTPUT + echo "include=[]" >> $GITHUB_OUTPUT fi - conda-build: + test: + defaults: {run: {shell: 'bash -el {0}'}} + runs-on: ${{ matrix.os }}-${{ matrix.os == 'ubuntu' && '24.04' || '2022' }} + needs: test-matrix + strategy: + matrix: + os: ${{ fromJson(needs.test-matrix.outputs.os) }} + python-version: ${{ fromJson(needs.test-matrix.outputs.python-version) }} + numpy-version: ${{ fromJson(needs.test-matrix.outputs.numpy-version) }} + include: ${{ fromJson(needs.test-matrix.outputs.include) }} + steps: + - uses: actions/checkout@v6 + with: {fetch-depth: 0, submodules: recursive} + - name: set requirements + run: sed -ri -e '/ python /d' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' -e 's/cuda*//' -e '/tigre/d' scripts/cil_development.yml + - uses: conda-incubator/setup-miniconda@v4 + with: + python-version: ${{ matrix.python-version }} + environment-file: scripts/cil_development.yml + activate-environment: cil_dev + - run: pip install . + - name: test + run: python -m unittest discover -v ./Wrappers/Python/test + conda-build-test: runs-on: ${{ matrix.os }}-${{ matrix.os == 'ubuntu' && '24.04' || '2022' }} - needs: conda-matrix + needs: test-matrix strategy: matrix: - os: ${{ fromJson(needs.conda-matrix.outputs.os) }} + os: ${{ fromJson(needs.test-matrix.outputs.os) }} + python-version: ${{ fromJson(needs.test-matrix.outputs.python-version) }} + include: ${{ fromJson(needs.test-matrix.outputs.conda-include) }} steps: - uses: actions/checkout@v6 with: @@ -129,46 +135,19 @@ jobs: - uses: prefix-dev/rattler-build-action@v0.2.37 with: recipe-path: recipe.yaml - build-args: --experimental -c conda-forge -c https://software.repos.intel.com/python/conda -c ccpi --no-test - artifact-name: conda-${{ matrix.os }} - conda-test: - defaults: {run: {shell: 'bash -el {0}'}} - runs-on: ${{ matrix.os }}-${{ matrix.os == 'ubuntu' && '24.04' || '2022' }} - needs: [conda-matrix, conda-build] - strategy: - matrix: - python-version: ${{ fromJson(needs.conda-matrix.outputs.python-version) }} - numpy-version: ${{ fromJson(needs.conda-matrix.outputs.numpy-version) }} - os: ${{ fromJson(needs.conda-matrix.outputs.os) }} - include: ${{ fromJson(needs.conda-matrix.outputs.include-numpy) }} - steps: - - uses: actions/checkout@v6 - - uses: conda-incubator/setup-miniconda@v4 - with: - python-version: ${{ matrix.python-version }} - mamba-version: "*" - channels: conda-forge - conda-remove-defaults: "true" - - run: conda install conda-build - - uses: actions/download-artifact@v8 - with: - name: conda-${{ matrix.os }} - path: output - - name: conda test - run: > - conda build -c conda-forge -c https://software.repos.intel.com/python/conda -c ccpi --override-channels --python=${{ matrix.python-version }} - --test output/*/cil-* --extra-deps numpy=${{ matrix.numpy-version }} + build-args: --experimental -c conda-forge -c https://software.repos.intel.com/python/conda -c ccpi --variant python=${{ matrix.python-version }} + artifact-name: conda-py${{ matrix.python-version }}-${{ matrix.os }} conda-upload: if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') - defaults: {run: {shell: 'bash -el {0}', working-directory: output}} - runs-on: ubuntu-latest - needs: conda-test + defaults: {run: {working-directory: output}} + runs-on: ubuntu-slim + needs: conda-build-test steps: - uses: actions/checkout@v6 - uses: prefix-dev/rattler-build-action@v0.2.37 with: {setup-only: true} - uses: actions/download-artifact@v8 - with: {pattern: conda-*, path: output, merge-multiple: true} + with: {pattern: conda-py*-*, path: output, merge-multiple: true} - name: conda upload -c ccpi run: > rattler-build upload anaconda */*.conda -f @@ -290,6 +269,6 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} pass: - needs: [test-cuda, test, conda-test, docs, docker] - runs-on: ubuntu-latest + needs: [test-cuda, test, conda-build-test, docs, docker] + runs-on: ubuntu-slim steps: [{run: echo success}] diff --git a/recipe.yaml b/recipe.yaml index db40f657b..f184f4eae 100644 --- a/recipe.yaml +++ b/recipe.yaml @@ -2,7 +2,6 @@ schema_version: 1 context: name: ${{ load_from_file("pyproject.toml").project.name }} # ratter-build --experimental - python_min: ${{ load_from_file("pyproject.toml")['project']['requires-python'] | replace(">=", "") }} # ratter-build --experimental build_number: 0 version: ${{ git.latest_tag(".") | replace("v", "") }} # .dev${{ build_number }}+g${{ git.head_rev(".") }} # ratter-build --experimental test_gpu: ${{ env.get("TESTS_FORCE_GPU", default="") | bool }} @@ -19,7 +18,6 @@ source: build: number: ${{ build_number }} - noarch: python script: content: - if: win @@ -46,13 +44,13 @@ requirements: then: - ipp-include ${{ ipp_version }} - ipp-devel ${{ ipp_version }} - - python ${{ python_min ~ '.*' }} + - python - pip - setuptools >=64 - setuptools_scm >=8 - scikit-build-core >=0.10 run: - - python >=${{ python_min }} + - python - packaging - if: x86_64 then: ipp ${{ ipp_version }} @@ -79,8 +77,6 @@ tests: - cil - cil.framework - cil.version - pip_check: false - python_version: ["${{ python_min ~ '.*' }}", "3.*"] - script: - pip install unittest-parametrize - python -m unittest discover -v -s Wrappers/Python/test From c5da95029d5fe70a87a9cda66d06b9b561f5834a Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Thu, 7 May 2026 17:58:50 +0000 Subject: [PATCH 5/6] CI: speed up setup-miniconda --- .github/workflows/build.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 706ef6c7f..58f4604f9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,8 +41,11 @@ jobs: - uses: conda-incubator/setup-miniconda@v4 with: python-version: ${{ matrix.python-version }} - environment-file: scripts/cil_development.yml + use-mamba: true + mamba-version: "*" + channels: conda-forge activate-environment: ${{ steps.reqs.outputs.envname }} + environment-file: scripts/cil_development.yml run-post: false - id: build name: build @@ -107,12 +110,15 @@ jobs: - uses: actions/checkout@v6 with: {fetch-depth: 0, submodules: recursive} - name: set requirements - run: sed -ri -e '/ python /d' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' -e 's/cuda*//' -e '/tigre/d' scripts/cil_development.yml + run: sed -ri -e 's/(.* python) .*/\1=${{ matrix.python-version }}/' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' -e 's/cuda*//' -e '/tigre/d' scripts/cil_development.yml - uses: conda-incubator/setup-miniconda@v4 with: - python-version: ${{ matrix.python-version }} - environment-file: scripts/cil_development.yml + miniforge-version: latest + use-mamba: true + mamba-version: "*" + channels: conda-forge activate-environment: cil_dev + environment-file: scripts/cil_development.yml - run: pip install . - name: test run: python -m unittest discover -v ./Wrappers/Python/test @@ -172,10 +178,12 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA - uses: conda-incubator/setup-miniconda@v4 with: + miniforge-version: latest + use-mamba: true python-version: 3.12 mamba-version: "*" channels: conda-forge - conda-remove-defaults: "true" + conda-remove-defaults: true - uses: ruby/setup-ruby@v1 with: ruby-version: '3.2' @@ -184,7 +192,7 @@ jobs: - name: install dependencies run: | mamba install -c conda-forge -yq conda-merge - sed -ri -e 's/cuda*//' -e '/tigre/d' ../scripts/cil_development.yml + sed -ri -e 's/(.* python) .*/\1=3.12/' -e 's/cuda*//' -e '/tigre/d' ../scripts/cil_development.yml conda-merge ../scripts/cil_development.yml docs_environment.yml > environment.yml mamba env update -n test --file environment.yml conda list From be7811b0d639a052d82193f74e14cd83a82a836e Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Fri, 8 May 2026 16:23:13 +0000 Subject: [PATCH 6/6] force non-cuda astra where appropriate - follow-up to #2323 --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58f4604f9..343038a24 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -110,7 +110,7 @@ jobs: - uses: actions/checkout@v6 with: {fetch-depth: 0, submodules: recursive} - name: set requirements - run: sed -ri -e 's/(.* python) .*/\1=${{ matrix.python-version }}/' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' -e 's/cuda*//' -e '/tigre/d' scripts/cil_development.yml + run: sed -ri -e 's/(.* python) .*/\1=${{ matrix.python-version }}/' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' -e 's/cuda*/py*/' -e '/tigre/d' scripts/cil_development.yml - uses: conda-incubator/setup-miniconda@v4 with: miniforge-version: latest @@ -192,7 +192,7 @@ jobs: - name: install dependencies run: | mamba install -c conda-forge -yq conda-merge - sed -ri -e 's/(.* python) .*/\1=3.12/' -e 's/cuda*//' -e '/tigre/d' ../scripts/cil_development.yml + sed -ri -e 's/(.* python) .*/\1=3.12/' -e 's/cuda*/py*/' -e '/tigre/d' ../scripts/cil_development.yml conda-merge ../scripts/cil_development.yml docs_environment.yml > environment.yml mamba env update -n test --file environment.yml conda list