Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
180 changes: 74 additions & 106 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,22 @@ 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
run: |
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
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
Expand All @@ -60,35 +63,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@v4
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
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: ${{ steps.matrix.outputs.include }}
include-numpy: ${{ steps.matrix.outputs.include-numpy }}
conda-include: ${{ steps.matrix.outputs.conda-include }}
steps:
- id: matrix
run: |
Expand All @@ -109,113 +91,99 @@ 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
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=[]" >> $GITHUB_OUTPUT
echo "include-numpy=[]" >> $GITHUB_OUTPUT
fi
conda-build:
test:
defaults: {run: {shell: 'bash -el {0}'}}
runs-on: ${{ matrix.os }}-${{ matrix.os == 'ubuntu' && '24.04' || '2022' }}
needs: conda-matrix
needs: test-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) }}
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@v4
with:
fetch-depth: 0
submodules: recursive
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
- 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*/py*/' -e '/tigre/d' scripts/cil_development.yml
- uses: conda-incubator/setup-miniconda@v4
with:
python-version: ${{ matrix.python-version }}
miniforge-version: latest
use-mamba: true
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
with:
name: cil-py${{ matrix.python-version }}-${{ matrix.os }}
path: dist/*/cil-*
conda-test:
defaults: {run: {shell: 'bash -el {0}'}}
activate-environment: cil_dev
environment-file: scripts/cil_development.yml
- 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, conda-build]
needs: test-matrix
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) }}
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@v4
- uses: conda-incubator/setup-miniconda@v3
- uses: actions/checkout@v6
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
fetch-depth: 0
submodules: recursive
ref: ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA
- if: matrix.os == 'windows'
uses: ilammy/msvc-dev-cmd@v1
- uses: prefix-dev/rattler-build-action@v0.2.37
with:
name: cil-py${{ matrix.python-version }}-${{ matrix.os }}
path: dist
- 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 }}
recipe-path: recipe.yaml
build-args: --experimental -c conda-forge -c https://software.repos.intel.com/python/conda -c ccpi --variant python=${{ matrix.python-version }}
Comment thread
casperdcl marked this conversation as resolved.
artifact-name: conda-py${{ matrix.python-version }}-${{ matrix.os }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why this is now named 'conda' - it used to be named 'cil'?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. makes it clear that the art[ie]fact is a conda file in the GitHub UI
  2. makes it easy to copy-paste this code to other libraries we maintain without modification

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to be consistent with the previous naming: https://anaconda.org/channels/ccpi/packages/cil/files

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conda file names are unchanged. This is just the GitHub art[ie]fact zip name

conda-upload:
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
defaults: {run: {shell: 'bash -el {0}', working-directory: dist}}
runs-on: ubuntu-latest
needs: conda-test
defaults: {run: {working-directory: output}}
runs-on: ubuntu-slim
needs: conda-build-test
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
mamba-version: "*"
channels: conda-forge
conda-remove-defaults: "true"
- uses: actions/download-artifact@v4
with: {pattern: cil-py*-*, path: dist, merge-multiple: true}
- run: mamba install anaconda-client
- name: anaconda upload -c ccpi
- 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-py*-*, 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:
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:
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'
Expand All @@ -224,18 +192,18 @@ 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*/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
- 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}
Expand All @@ -245,7 +213,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
Expand All @@ -263,7 +231,7 @@ jobs:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: recursive
Expand All @@ -272,8 +240,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 }}
Expand All @@ -283,13 +251,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
Expand All @@ -300,7 +268,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
Expand All @@ -309,6 +277,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}]
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/build*
/output/
__pycache__/
/Wrappers/Python/cil-*.dist-info/
/Wrappers/Python/cil/include/
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -25,6 +26,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:
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 = [
Expand All @@ -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",
Expand Down
Loading
Loading