c2ImageD11 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. c2imaged11-0.2.1/.githooks/check_all_pythons.sh +75 -0
  2. c2imaged11-0.2.1/.githooks/pre-commit +78 -0
  3. c2imaged11-0.2.1/.githooks/pre-push +50 -0
  4. c2imaged11-0.2.1/.github/workflows/test-aarch64.yml +51 -0
  5. c2imaged11-0.2.1/.github/workflows/test-py27.yml +139 -0
  6. c2imaged11-0.2.1/.github/workflows/test.yml +187 -0
  7. c2imaged11-0.2.1/AGENTS.md +267 -0
  8. c2imaged11-0.2.1/LICENSE +674 -0
  9. c2imaged11-0.2.1/MANIFEST.in +28 -0
  10. c2imaged11-0.2.1/PKG-INFO +64 -0
  11. c2imaged11-0.2.1/README.md +43 -0
  12. c2imaged11-0.2.1/c2ImageD11/__init__.py +136 -0
  13. c2imaged11-0.2.1/c2ImageD11.egg-info/PKG-INFO +64 -0
  14. c2imaged11-0.2.1/c2ImageD11.egg-info/SOURCES.txt +46 -0
  15. c2imaged11-0.2.1/c2ImageD11.egg-info/dependency_links.txt +1 -0
  16. c2imaged11-0.2.1/c2ImageD11.egg-info/not-zip-safe +1 -0
  17. c2imaged11-0.2.1/c2ImageD11.egg-info/requires.txt +1 -0
  18. c2imaged11-0.2.1/c2ImageD11.egg-info/top_level.txt +1 -0
  19. c2imaged11-0.2.1/lib/interface/_cImageD11.c2py +705 -0
  20. c2imaged11-0.2.1/lib/interface/_cImageD11_wrapper.c +27638 -0
  21. c2imaged11-0.2.1/lib/interface/c2py_amd64.h +49 -0
  22. c2imaged11-0.2.1/lib/interface/c2py_arm64.h +34 -0
  23. c2imaged11-0.2.1/lib/interface/c2py_ppc64.h +27 -0
  24. c2imaged11-0.2.1/lib/interface/c2py_runtime.c +847 -0
  25. c2imaged11-0.2.1/lib/interface/c2py_runtime.h +760 -0
  26. c2imaged11-0.2.1/lib/meson.build +69 -0
  27. c2imaged11-0.2.1/lib/src/core/ImageD11_cmath.h +45 -0
  28. c2imaged11-0.2.1/lib/src/core/cImageD11.h +69 -0
  29. c2imaged11-0.2.1/lib/src/core/cimaged11utils.c +93 -0
  30. c2imaged11-0.2.1/lib/src/geometry/cdiffraction.c +464 -0
  31. c2imaged11-0.2.1/lib/src/geometry/cdiffraction.h +16 -0
  32. c2imaged11-0.2.1/lib/src/geometry/closest.c +1299 -0
  33. c2imaged11-0.2.1/lib/src/imageproc/blobs.c +292 -0
  34. c2imaged11-0.2.1/lib/src/imageproc/blobs.h +152 -0
  35. c2imaged11-0.2.1/lib/src/imageproc/connectedpixels.c +648 -0
  36. c2imaged11-0.2.1/lib/src/imageproc/darkflat.c +757 -0
  37. c2imaged11-0.2.1/lib/src/imageproc/localmaxlabel.c +220 -0
  38. c2imaged11-0.2.1/lib/src/imageproc/sparse_image.c +1191 -0
  39. c2imaged11-0.2.1/lib/src/imageproc/splat.c +77 -0
  40. c2imaged11-0.2.1/pyproject.toml +37 -0
  41. c2imaged11-0.2.1/setup.cfg +4 -0
  42. c2imaged11-0.2.1/setup.py +117 -0
  43. c2imaged11-0.2.1/tests/benchmark_timing.py +197 -0
  44. c2imaged11-0.2.1/tests/conftest.py +0 -0
  45. c2imaged11-0.2.1/tests/test_buffer.py +177 -0
  46. c2imaged11-0.2.1/tests/test_equivalence.py +670 -0
  47. c2imaged11-0.2.1/tools/harvester.py +289 -0
  48. c2imaged11-0.2.1/tools/strip_c2py.py +74 -0
@@ -0,0 +1,75 @@
1
+ #!/bin/bash
2
+ # Check all .py files for Python 2.7-3.14 syntax compatibility via snakepit.
3
+ # Usage: bash .githooks/check_all_pythons.sh [files...]
4
+ # If no files given, checks all non-submodule .py files in the repo.
5
+
6
+ set -e
7
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
8
+ REPO_DIR="$(dirname "$SCRIPT_DIR")"
9
+ SNAKEPIT_DIR="$HOME/snakepit"
10
+
11
+ # Container -> Python versions
12
+ # ubuntu20.04.sif has python2.7, python3.8
13
+ # ubuntu24.04.sif has python3.9..3.14
14
+ CONTAINERS=(
15
+ "ubuntu20.04.sif:python2.7:python2"
16
+ "ubuntu20.04.sif:python3.8:python3.8"
17
+ "ubuntu24.04.sif:python3.9:python3.9"
18
+ "ubuntu24.04.sif:python3.10:python3.10"
19
+ "ubuntu24.04.sif:python3.11:python3.11"
20
+ "ubuntu24.04.sif:python3.12:python3.12"
21
+ "ubuntu24.04.sif:python3.13:python3.13"
22
+ "ubuntu24.04.sif:python3.14:python3.14"
23
+ )
24
+
25
+ if [ $# -gt 0 ]; then
26
+ FILES=("$@")
27
+ else
28
+ # All non-submodule, non-build, non-thirdparty .py files
29
+ cd "$REPO_DIR"
30
+ FILES=()
31
+ while IFS= read -r f; do
32
+ case "$f" in
33
+ lz4/*|bitshuffle/*|kcb/*|zstd/*|build/*|venv/*|.eggs/*|__pycache__/*) ;;
34
+ *) FILES+=("$f") ;;
35
+ esac
36
+ done < <(find . -name '*.py' -not -path '*/.venv/*' -not -path '*/build/*' -not -path '*/__pycache__/*' -not -path '*/lz4/*' -not -path '*/bitshuffle/*' -not -path '*/kcb/*' -not -path '*/zstd/*')
37
+ fi
38
+
39
+ echo "Checking ${#FILES[@]} Python files across 8 Python versions..."
40
+ echo
41
+
42
+ HAD_ERROR=0
43
+
44
+ for entry in "${CONTAINERS[@]}"; do
45
+ IFS=':' read -r sif pyver pybin <<< "$entry"
46
+ sif_path="$SNAKEPIT_DIR/$sif"
47
+ if [ ! -f "$sif_path" ]; then
48
+ echo "SKIP $pyver: SIF not found at $sif_path"
49
+ continue
50
+ fi
51
+
52
+ errors=0
53
+ for f in "${FILES[@]}"; do
54
+ f_abs="$(cd "$REPO_DIR" && realpath "$f" 2>/dev/null || echo "$f")"
55
+ f_rel="${f#./}"
56
+ output=$(apptainer exec -e -B "$REPO_DIR:$REPO_DIR" "$sif_path" \
57
+ "$pybin" -m py_compile "$f_abs" 2>&1) || {
58
+ echo "FAIL $pyver: $f_rel"
59
+ echo "$output"
60
+ errors=1
61
+ HAD_ERROR=1
62
+ }
63
+ done
64
+ if [ $errors -eq 0 ]; then
65
+ echo "PASS $pyver (${#FILES[@]} files)"
66
+ fi
67
+ done
68
+
69
+ echo
70
+ if [ "$HAD_ERROR" -eq 0 ]; then
71
+ echo "All files pass all Python versions."
72
+ else
73
+ echo "Some files have syntax errors. See above."
74
+ exit 1
75
+ fi
@@ -0,0 +1,78 @@
1
+ #!/bin/bash
2
+ # Pre-commit hook: reject non-ASCII chars and Python 2.7 syntax violations.
3
+ # Install: ln -s ../../.githooks/pre-commit .git/hooks/pre-commit
4
+
5
+ STAGED=$(git diff --cached --name-only --diff-filter=ACM)
6
+ PYTHON_FILES=$(echo "$STAGED" | grep '\.py$' || true)
7
+
8
+ # ---- Check 1: non-ASCII characters ----
9
+ if [ -n "$STAGED" ] && echo "$STAGED" | xargs -r -I{} grep -PHn '[^\x00-\x7F]' {} 2>/dev/null; then
10
+ echo
11
+ echo "ERROR: non-ASCII characters found. Replace with ASCII equivalents:"
12
+ echo " U+2192 -> (arrow) -> ->"
13
+ echo " U+2014 -- (em dash) -> --"
14
+ echo " U+2013 - (en dash) -> -"
15
+ echo " U+00D7 x (multi sign) -> x"
16
+ echo " U+2265 >= (greater-equal) -> >="
17
+ exit 1
18
+ fi
19
+
20
+ # ---- Check 2: Python 2.7 syntax compatibility ----
21
+ if [ -z "$PYTHON_FILES" ]; then
22
+ exit 0
23
+ fi
24
+
25
+ _resolve_python() {
26
+ local name="$1"
27
+ if command -v "$name" >/dev/null 2>&1 && "$name" -c "import sys; sys.exit(0)" 2>/dev/null; then
28
+ echo "$name"
29
+ return 0
30
+ fi
31
+ # Try pyenv shims
32
+ for d in "$HOME/.pyenv/shims" "$HOME/.pyenv/versions"/*/bin; do
33
+ for cand in "$name" "$name".*; do
34
+ if [ -x "$d/$cand" ] && "$d/$cand" -c "import sys; sys.exit(0)" 2>/dev/null; then
35
+ echo "$d/$cand"
36
+ return 0
37
+ fi
38
+ done
39
+ done
40
+ return 1
41
+ }
42
+
43
+ check_python() {
44
+ local python_bin
45
+ python_bin=$(_resolve_python "$1")
46
+ local ver_label="$2"
47
+ local errors=0
48
+
49
+ if [ -z "$python_bin" ]; then
50
+ echo "c2ImageD11: $ver_label not found, skipping syntax check"
51
+ return 0
52
+ fi
53
+
54
+ for f in $PYTHON_FILES; do
55
+ if ! "$python_bin" -m py_compile "$f" 2>/dev/null; then
56
+ echo
57
+ echo "ERROR: $f fails to compile on $ver_label:"
58
+ "$python_bin" -m py_compile "$f" 2>&1 || true
59
+ errors=1
60
+ fi
61
+ done
62
+ return $errors
63
+ }
64
+
65
+ HAD_ERROR=0
66
+ check_python python2 "Python 2.7" || HAD_ERROR=1
67
+ check_python python3 "Python 3.x" || HAD_ERROR=1
68
+
69
+ if [ "$HAD_ERROR" -eq 1 ]; then
70
+ echo
71
+ echo "Python 2.7 syntax subset rules (from AGENTS.md):"
72
+ echo " Do NOT use: f-strings, type annotations, async/await, nonlocal,"
73
+ echo " yield from, {**d}, [*l], @ matrix multiply, keyword-only args."
74
+ echo " Use %% or .format() for string formatting."
75
+ exit 1
76
+ fi
77
+
78
+ exit 0
@@ -0,0 +1,50 @@
1
+ #!/bin/bash
2
+ # Pre-push hook: run buffer-protocol smoke tests under valgrind on master pushes.
3
+ # Install: ln -sf ../../.githooks/pre-push .git/hooks/pre-push
4
+
5
+ set -euo pipefail
6
+
7
+ ZERO_COMMIT="0000000000000000000000000000000000000000"
8
+ while read LOCAL_REF LOCAL_SHA REMOTE_REF REMOTE_SHA; do
9
+ if [ "$REMOTE_REF" = "refs/heads/master" ]; then
10
+ MASTER_PUSH=1
11
+ fi
12
+ done
13
+
14
+ if [ -z "${MASTER_PUSH:-}" ]; then
15
+ exit 0
16
+ fi
17
+
18
+ REPO_ROOT="$(git rev-parse --show-toplevel)"
19
+ cd "$REPO_ROOT"
20
+
21
+ VENV_PYTHON="$REPO_ROOT/venv/py312/x86_64/bin/python3"
22
+ if [ -x "$VENV_PYTHON" ]; then
23
+ PYTHON="$VENV_PYTHON"
24
+ else
25
+ PYTHON="python3"
26
+ fi
27
+
28
+ if command -v valgrind &>/dev/null; then
29
+ echo "Running smoke tests under valgrind..."
30
+ valgrind \
31
+ --tool=memcheck \
32
+ --leak-check=full \
33
+ --error-exitcode=1 \
34
+ --errors-for-leak-kinds=definite \
35
+ --track-origins=yes \
36
+ $PYTHON -m pytest "$REPO_ROOT/tests/test_buffer.py" -v 2>&1 || {
37
+ echo "FAILED: Memory safety check detected errors!"
38
+ echo "Run locally: valgrind --leak-check=full --track-origins=yes"
39
+ echo " python3 -m pytest tests/test_buffer.py -v"
40
+ exit 1
41
+ }
42
+ echo "Memory check passed."
43
+ else
44
+ echo "valgrind not installed, falling back to plain smoke tests..."
45
+ $PYTHON -m pytest "$REPO_ROOT/tests/test_buffer.py" -v 2>&1 || {
46
+ echo "FAILED: Smoke tests failed!"
47
+ exit 1
48
+ }
49
+ echo "Smoke tests passed."
50
+ fi
@@ -0,0 +1,51 @@
1
+ name: CI (aarch64)
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ aarch64-test:
7
+ runs-on: ubuntu-24.04-arm
8
+ timeout-minutes: 15
9
+ steps:
10
+ - uses: actions/checkout@v4
11
+
12
+ - name: Setup Python 3.12
13
+ uses: actions/setup-python@v5
14
+ with:
15
+ python-version: "3.12"
16
+
17
+ - name: Install build deps
18
+ run: |
19
+ pip install git+https://github.com/jonwright/c2py23.git
20
+ pip install meson ninja numpy pytest "setuptools>=70.1" auditwheel
21
+
22
+ - name: Regenerate lib/interface from C sources
23
+ run: |
24
+ python tools/harvester.py --output-dir lib/interface
25
+
26
+ - name: Build _cImageD11.so
27
+ run: |
28
+ mkdir -p build/libc2ImageD11
29
+ cd build/libc2ImageD11
30
+ meson setup ../../lib
31
+ ninja
32
+ cp _cImageD11.so ../../c2ImageD11/_cImageD11_aarch64.so
33
+
34
+ - name: Build wheel
35
+ run: |
36
+ python setup.py bdist_wheel
37
+
38
+ - name: Repair wheel for manylinux
39
+ run: |
40
+ auditwheel repair dist/*.whl -w /tmp/wheelhouse/
41
+ rm -f dist/*.whl
42
+ mv /tmp/wheelhouse/*.whl dist/
43
+
44
+ - uses: actions/upload-artifact@v4
45
+ with:
46
+ name: dist-linux-aarch64
47
+ path: dist/
48
+
49
+ - name: Run tests
50
+ run: |
51
+ python -m pytest tests/test_buffer.py tests/test_equivalence.py -v
@@ -0,0 +1,139 @@
1
+ name: CI (Python 2.7)
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ linux-py27:
7
+ runs-on: ubuntu-22.04
8
+ steps:
9
+ - uses: actions/checkout@v4
10
+
11
+ - name: Install system deps
12
+ run: |
13
+ sudo apt-get update -qq
14
+ sudo apt-get install -y -qq --no-install-recommends python2 python2-dev python3 python3-pip python3-wheel gcc curl
15
+
16
+ - name: Install pip for Python 2
17
+ run: |
18
+ curl -sS https://bootstrap.pypa.io/pip/2.7/get-pip.py | sudo python2
19
+
20
+ - name: Install build deps
21
+ run: |
22
+ python3 -m pip install "setuptools>=70.1" "packaging>=24.2" meson ninja auditwheel
23
+ python2 -m pip install numpy==1.16.6 "pytest>=4.6,<5" wheel
24
+
25
+ - name: Build _cImageD11.so
26
+ run: |
27
+ meson setup build/libc2ImageD11 lib
28
+ ninja -C build/libc2ImageD11
29
+ cp build/libc2ImageD11/_cImageD11.so c2ImageD11/_cImageD11.so
30
+ cp build/libc2ImageD11/_cImageD11.so c2ImageD11/_cImageD11_x86_64.so
31
+
32
+ - name: Build py2 wheel (using python3 setuptools for proper platlib)
33
+ run: |
34
+ C2IMAGED11_PYTHON_TAG=py2 python3 setup.py bdist_wheel
35
+
36
+ - name: Repair wheel for manylinux (via python3)
37
+ run: |
38
+ python3 -m auditwheel repair dist/*.whl -w /tmp/wheelhouse/
39
+ rm -f dist/*.whl
40
+ mv /tmp/wheelhouse/*.whl dist/
41
+
42
+ - uses: actions/upload-artifact@v4
43
+ with:
44
+ name: dist-linux-py2
45
+ path: dist/
46
+
47
+ - name: Run buffer tests
48
+ run: |
49
+ python2 -m pytest tests/test_buffer.py -v
50
+
51
+ - name: Build ImageD11 1.9.8 from source
52
+ run: |
53
+ python2 -m pip download --no-deps --no-binary ImageD11 ImageD11==1.9.8 -d /tmp/imaged11_src
54
+ cd /tmp/imaged11_src
55
+ tar xzf ImageD11-1.9.8.tar.gz
56
+ cd ImageD11-1.9.8
57
+ python2 setup.py build_ext --inplace
58
+
59
+ - name: Run equivalence tests
60
+ run: |
61
+ PYTHONPATH=/tmp/imaged11_src/ImageD11-1.9.8:$PYTHONPATH python2 -m pytest tests/test_equivalence.py -v
62
+ continue-on-error: true
63
+
64
+ windows-py27:
65
+ runs-on: windows-2022
66
+ steps:
67
+ - uses: actions/checkout@v4
68
+
69
+ - name: Install Python 2.7
70
+ shell: cmd
71
+ run: |
72
+ curl -L -o %TEMP%\python27.msi https://www.python.org/ftp/python/2.7.18/python-2.7.18.amd64.msi
73
+ msiexec /i %TEMP%\python27.msi /quiet /qn /norestart TARGETDIR=C:\Python27
74
+ echo C:\Python27>> %GITHUB_PATH%
75
+ echo C:\Python27\Scripts>> %GITHUB_PATH%
76
+
77
+ - name: Setup Python 3 (for meson)
78
+ uses: actions/setup-python@v5
79
+ with:
80
+ python-version: "3.10"
81
+
82
+ - name: Install meson and ninja (Python 3)
83
+ shell: cmd
84
+ run: |
85
+ python -m pip install "setuptools>=70.1" "packaging>=24.2" meson ninja
86
+
87
+ - name: Install Python 2.7 deps
88
+ shell: cmd
89
+ run: |
90
+ C:\Python27\python.exe --version
91
+ C:\Python27\python.exe -m pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org
92
+ C:\Python27\python.exe -m pip install --only-binary :all: numpy==1.16.6 --trusted-host pypi.org --trusted-host files.pythonhosted.org || C:\Python27\python.exe -m pip install numpy==1.16.6 --trusted-host pypi.org --trusted-host files.pythonhosted.org || echo numpy install failed
93
+ C:\Python27\python.exe -m pip install "pytest>=4.6,<5" wheel --trusted-host pypi.org --trusted-host files.pythonhosted.org
94
+
95
+ - name: Build _cImageD11.pyd
96
+ shell: cmd
97
+ run: |
98
+ for /f "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath') do call "%%i\VC\Auxiliary\Build\vcvars64.bat" >nul
99
+ set CC=cl
100
+ mkdir build 2>nul
101
+ mkdir build\libc2ImageD11 2>nul
102
+ meson setup build\libc2ImageD11 lib
103
+ ninja -C build\libc2ImageD11
104
+ copy build\libc2ImageD11\_cImageD11.dll c2ImageD11\_cImageD11.pyd
105
+ copy build\libc2ImageD11\_cImageD11.dll c2ImageD11\_cImageD11_AMD64.pyd
106
+
107
+ - name: Build py2 wheel (using python3 setuptools for proper platlib)
108
+ shell: cmd
109
+ run: |
110
+ set C2IMAGED11_PYTHON_TAG=py2
111
+ python setup.py bdist_wheel
112
+
113
+ - uses: actions/upload-artifact@v4
114
+ with:
115
+ name: dist-windows-py2
116
+ path: dist/
117
+
118
+ - name: Run buffer tests
119
+ shell: cmd
120
+ run: |
121
+ C:\Python27\python.exe -m pytest tests\test_buffer.py -v
122
+
123
+ - name: Install VC++ 2008 redist
124
+ shell: cmd
125
+ run: |
126
+ curl -L -o %TEMP%\vcredist_x64.exe https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x64.exe
127
+ start /wait %TEMP%\vcredist_x64.exe /q /norestart
128
+ continue-on-error: true
129
+
130
+ - name: Install ImageD11 1.9.8 (cp27 wheel)
131
+ shell: cmd
132
+ run: |
133
+ C:\Python27\python.exe -m pip install ImageD11==1.9.8 --only-binary :all: --no-deps
134
+
135
+ - name: Run equivalence tests
136
+ shell: cmd
137
+ run: |
138
+ C:\Python27\python.exe -m pytest tests\test_equivalence.py -v
139
+ continue-on-error: true
@@ -0,0 +1,187 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ linux-wheel:
7
+ runs-on: ubuntu-latest
8
+ container: quay.io/pypa/manylinux_2_28_x86_64
9
+ steps:
10
+ - uses: actions/checkout@v4
11
+
12
+ - name: Setup Python and install build deps
13
+ run: |
14
+ export PATH="/opt/python/cp312-cp312/bin:$PATH"
15
+ pip install git+https://github.com/jonwright/c2py23.git
16
+ pip install meson ninja setuptools auditwheel
17
+ echo "PATH=/opt/python/cp312-cp312/bin:$PATH" >> "$GITHUB_ENV"
18
+
19
+ - name: Regenerate lib/interface from C sources
20
+ run: |
21
+ python tools/harvester.py --output-dir lib/interface
22
+
23
+ - name: Build .so with meson
24
+ run: |
25
+ mkdir -p build/libc2ImageD11
26
+ cd build/libc2ImageD11
27
+ meson setup ../../lib
28
+ ninja
29
+ cp _cImageD11.so ../../c2ImageD11/_cImageD11_x86_64.so
30
+
31
+ - name: Build wheel
32
+ run: |
33
+ python setup.py bdist_wheel
34
+
35
+ - name: Repair wheel for manylinux
36
+ run: |
37
+ auditwheel repair --plat manylinux_2_28_x86_64 dist/*.whl -w /tmp/wheelhouse/
38
+ rm -f dist/*.whl
39
+ mv /tmp/wheelhouse/*.whl dist/
40
+
41
+ - uses: actions/upload-artifact@v4
42
+ with:
43
+ name: dist-linux
44
+ path: dist/
45
+
46
+ linux-test-matrix:
47
+ needs: [linux-wheel]
48
+ strategy:
49
+ fail-fast: false
50
+ matrix:
51
+ python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
52
+ runs-on: ubuntu-latest
53
+ steps:
54
+ - uses: actions/checkout@v4
55
+
56
+ - name: Download wheel
57
+ uses: actions/download-artifact@v4
58
+ with:
59
+ name: dist-linux
60
+ path: dist/
61
+
62
+ - name: Setup Python ${{ matrix.python-version }}
63
+ uses: actions/setup-python@v5
64
+ with:
65
+ python-version: ${{ matrix.python-version }}
66
+
67
+ - name: Install c2ImageD11 wheel
68
+ run: |
69
+ pip install dist/*.whl
70
+
71
+ - name: Install ImageD11 (binary from PyPI, no deps)
72
+ run: |
73
+ pip install ImageD11 --only-binary :all: --no-deps
74
+
75
+ - name: Install test deps
76
+ run: |
77
+ pip install numpy pytest
78
+
79
+ - name: Run tests
80
+ run: |
81
+ cd "$(mktemp -d)" && python -m pytest "$GITHUB_WORKSPACE/tests/" -v
82
+
83
+ windows-wheel:
84
+ runs-on: windows-latest
85
+ defaults:
86
+ run:
87
+ shell: cmd
88
+ steps:
89
+ - uses: actions/checkout@v4
90
+
91
+ - name: Setup Python 3.12
92
+ uses: actions/setup-python@v5
93
+ with:
94
+ python-version: "3.12"
95
+
96
+ - name: Install build deps
97
+ run: |
98
+ pip install meson ninja numpy setuptools
99
+
100
+ - name: Build _cImageD11
101
+ run: |
102
+ for /f "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath') do call "%%i\VC\Auxiliary\Build\vcvars64.bat" >nul
103
+ set CC=cl
104
+ if not exist build\libc2ImageD11 mkdir build\libc2ImageD11
105
+ cd build\libc2ImageD11
106
+ meson setup ..\..\lib
107
+ ninja
108
+ copy _cImageD11.dll ..\..\c2ImageD11\_cImageD11_AMD64.pyd
109
+
110
+ - name: Build wheel
111
+ run: |
112
+ python setup.py bdist_wheel
113
+
114
+ - name: Repair wheel (delvewheel) - best effort
115
+ run: |
116
+ pip install delvewheel 2>nul || exit 0
117
+ if not exist "%TEMP%\wheelhouse" mkdir "%TEMP%\wheelhouse"
118
+ for /f "delims=" %%f in ('dir /b dist\*.whl 2^>nul') do delvewheel repair -w "%TEMP%\wheelhouse" "dist\%%f"
119
+ if exist dist\*.whl del /f /q dist\*.whl
120
+ if exist "%TEMP%\wheelhouse\*.whl" xcopy /y "%TEMP%\wheelhouse\*.whl" dist\
121
+ continue-on-error: true
122
+
123
+ - uses: actions/upload-artifact@v4
124
+ with:
125
+ name: dist-windows
126
+ path: dist/
127
+
128
+ windows-test-matrix:
129
+ needs: [windows-wheel]
130
+ strategy:
131
+ fail-fast: false
132
+ matrix:
133
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
134
+ runs-on: windows-latest
135
+ defaults:
136
+ run:
137
+ shell: cmd
138
+ steps:
139
+ - uses: actions/checkout@v4
140
+
141
+ - name: Download wheel
142
+ uses: actions/download-artifact@v4
143
+ with:
144
+ name: dist-windows
145
+ path: dist/
146
+
147
+ - name: Setup Python ${{ matrix.python-version }}
148
+ uses: actions/setup-python@v5
149
+ with:
150
+ python-version: ${{ matrix.python-version }}
151
+
152
+ - name: Install c2ImageD11 wheel
153
+ run: |
154
+ for /f "delims=" %%f in ('dir /b /s dist\*.whl') do pip install "%%f"
155
+
156
+ - name: Install ImageD11 (binary from PyPI, no deps)
157
+ run: |
158
+ pip install ImageD11 --only-binary :all: --no-deps
159
+
160
+ - name: Install test deps
161
+ run: |
162
+ pip install numpy pytest
163
+
164
+ - name: Run tests
165
+ run: |
166
+ move %GITHUB_WORKSPACE%\c2ImageD11\__init__.py %GITHUB_WORKSPACE%\c2ImageD11\__init__.py.bak
167
+ cd %TEMP% && python -m pytest %GITHUB_WORKSPACE%\tests\ -v
168
+
169
+ linux-test:
170
+ needs: [linux-test-matrix]
171
+ if: always()
172
+ runs-on: ubuntu-latest
173
+ steps:
174
+ - name: Verify all matrix jobs passed
175
+ run: |
176
+ [ "${{ needs.linux-test-matrix.result }}" = "success" ] || \
177
+ { echo "FAIL: some linux-test-matrix jobs failed (${{ needs.linux-test-matrix.result }})"; exit 1; }
178
+
179
+ windows-test:
180
+ needs: [windows-test-matrix]
181
+ if: always()
182
+ runs-on: ubuntu-latest
183
+ steps:
184
+ - name: Verify all matrix jobs passed
185
+ run: |
186
+ [ "${{ needs.windows-test-matrix.result }}" = "success" ] || \
187
+ { echo "FAIL: some windows-test-matrix jobs failed (${{ needs.windows-test-matrix.result }})"; exit 1; }