fimage-python 0.1.2__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 (198) hide show
  1. fimage_python-0.1.2/.bazelignore +14 -0
  2. fimage_python-0.1.2/.bazelrc +76 -0
  3. fimage_python-0.1.2/.bazelversion +1 -0
  4. fimage_python-0.1.2/.github/workflows/release.yml +299 -0
  5. fimage_python-0.1.2/.gitignore +19 -0
  6. fimage_python-0.1.2/BUILD.bazel +681 -0
  7. fimage_python-0.1.2/LICENSE +201 -0
  8. fimage_python-0.1.2/MANIFEST.in +29 -0
  9. fimage_python-0.1.2/MODULE.bazel +165 -0
  10. fimage_python-0.1.2/PKG-INFO +89 -0
  11. fimage_python-0.1.2/README.md +61 -0
  12. fimage_python-0.1.2/benchmarks/BUILD.bazel +30 -0
  13. fimage_python-0.1.2/benchmarks/fimage_crop_benchmark.cpp +240 -0
  14. fimage_python-0.1.2/benchmarks/fimage_resize_benchmark.cpp +218 -0
  15. fimage_python-0.1.2/benchmarks/vips_crop_benchmark.cpp +303 -0
  16. fimage_python-0.1.2/docs/BUILD.bazel +202 -0
  17. fimage_python-0.1.2/docs/Doxyfile +192 -0
  18. fimage_python-0.1.2/docs/Makefile +93 -0
  19. fimage_python-0.1.2/docs/README.md +215 -0
  20. fimage_python-0.1.2/docs/requirements.in +23 -0
  21. fimage_python-0.1.2/docs/requirements_darwin.txt +924 -0
  22. fimage_python-0.1.2/docs/requirements_linux.txt +924 -0
  23. fimage_python-0.1.2/docs/source/_static/custom.css +269 -0
  24. fimage_python-0.1.2/docs/source/api/cpp_api.rst +696 -0
  25. fimage_python-0.1.2/docs/source/api/index.rst +132 -0
  26. fimage_python-0.1.2/docs/source/api/python_api.rst +553 -0
  27. fimage_python-0.1.2/docs/source/architecture.rst +683 -0
  28. fimage_python-0.1.2/docs/source/conf.py +231 -0
  29. fimage_python-0.1.2/docs/source/examples/index.rst +455 -0
  30. fimage_python-0.1.2/docs/source/guides/adding_operator.rst +532 -0
  31. fimage_python-0.1.2/docs/source/guides/adding_sink.rst +502 -0
  32. fimage_python-0.1.2/docs/source/guides/adding_source.rst +503 -0
  33. fimage_python-0.1.2/docs/source/guides/fimage_format.rst +644 -0
  34. fimage_python-0.1.2/docs/source/guides/index.rst +232 -0
  35. fimage_python-0.1.2/docs/source/guides/python_bindings.rst +743 -0
  36. fimage_python-0.1.2/docs/source/index.rst +155 -0
  37. fimage_python-0.1.2/docs/source/overview.rst +261 -0
  38. fimage_python-0.1.2/examples/BUILD.bazel +65 -0
  39. fimage_python-0.1.2/examples/README.md +105 -0
  40. fimage_python-0.1.2/examples/checkerboard_demo.cpp +349 -0
  41. fimage_python-0.1.2/examples/cpp_paste_example.cpp +321 -0
  42. fimage_python-0.1.2/examples/demo.cpp +109 -0
  43. fimage_python-0.1.2/examples/fastslide_demo.cpp +235 -0
  44. fimage_python-0.1.2/examples/python/multitype_demo.py +86 -0
  45. fimage_python-0.1.2/examples/python_paste_example.py +340 -0
  46. fimage_python-0.1.2/examples/python_resize_example.py +311 -0
  47. fimage_python-0.1.2/examples/simple_resize_example.py +62 -0
  48. fimage_python-0.1.2/examples/test_fastslide_minimal.py +32 -0
  49. fimage_python-0.1.2/include/fim/image.h +274 -0
  50. fimage_python-0.1.2/include/fim/operators/convert_layout.h +63 -0
  51. fimage_python-0.1.2/include/fim/operators/crop.h +153 -0
  52. fimage_python-0.1.2/include/fim/operators/downsample.h +218 -0
  53. fimage_python-0.1.2/include/fim/operators/paste.h +246 -0
  54. fimage_python-0.1.2/include/fim/operators/resize/kernels.h +302 -0
  55. fimage_python-0.1.2/include/fim/operators/resize/resample.h +456 -0
  56. fimage_python-0.1.2/include/fim/operators/resize.h +517 -0
  57. fimage_python-0.1.2/include/fim/operators/stack.h +215 -0
  58. fimage_python-0.1.2/include/fim/pipeline.h +288 -0
  59. fimage_python-0.1.2/include/fim/pixel_type_traits.h +95 -0
  60. fimage_python-0.1.2/include/fim/pixel_types.h +67 -0
  61. fimage_python-0.1.2/include/fim/python/associated_images_dict.h +96 -0
  62. fimage_python-0.1.2/include/fim/python/deferred_black_canvas.h +91 -0
  63. fimage_python-0.1.2/include/fim/python/factory.h +989 -0
  64. fimage_python-0.1.2/include/fim/python/py_stage.h +217 -0
  65. fimage_python-0.1.2/include/fim/python/stage_adapter.h +143 -0
  66. fimage_python-0.1.2/include/fim/python/stage_concept.h +82 -0
  67. fimage_python-0.1.2/include/fim/python/stage_model.h +130 -0
  68. fimage_python-0.1.2/include/fim/sinks/fimage_sink.h +590 -0
  69. fimage_python-0.1.2/include/fim/sinks/lodepng_png_sink.h +280 -0
  70. fimage_python-0.1.2/include/fim/sinks/memory_sink.h +381 -0
  71. fimage_python-0.1.2/include/fim/sinks/spng_sink.h +347 -0
  72. fimage_python-0.1.2/include/fim/sinks/tiff_sink.h +936 -0
  73. fimage_python-0.1.2/include/fim/sources/associated_image_source.h +122 -0
  74. fimage_python-0.1.2/include/fim/sources/black_source.h +152 -0
  75. fimage_python-0.1.2/include/fim/sources/fastslide_source.h +417 -0
  76. fimage_python-0.1.2/include/fim/sources/fimage_source.h +270 -0
  77. fimage_python-0.1.2/include/fim/sources/lodepng_png_source.h +178 -0
  78. fimage_python-0.1.2/include/fim/sources/memory_source.h +222 -0
  79. fimage_python-0.1.2/include/fim/sources/openslide_source.h +387 -0
  80. fimage_python-0.1.2/include/fim/sources/tiff_source.h +311 -0
  81. fimage_python-0.1.2/include/fim/types.h +610 -0
  82. fimage_python-0.1.2/include/fim/utilities/buffer_pool.h +284 -0
  83. fimage_python-0.1.2/include/fim/utilities/compressor.h +119 -0
  84. fimage_python-0.1.2/include/fim/utilities/debug_flags.h +45 -0
  85. fimage_python-0.1.2/include/fim/utilities/decompressor.h +124 -0
  86. fimage_python-0.1.2/include/fim/utilities/layout_utils.h +148 -0
  87. fimage_python-0.1.2/include/fim/utilities/tile_helpers.h +186 -0
  88. fimage_python-0.1.2/include/fim/utilities/type_helpers.h +177 -0
  89. fimage_python-0.1.2/meson.build +167 -0
  90. fimage_python-0.1.2/meson.options +4 -0
  91. fimage_python-0.1.2/platforms/BUILD.bazel +121 -0
  92. fimage_python-0.1.2/platforms/platform_mappings +8 -0
  93. fimage_python-0.1.2/pyproject.toml +75 -0
  94. fimage_python-0.1.2/python/BUILD.bazel +86 -0
  95. fimage_python-0.1.2/python/example.py +94 -0
  96. fimage_python-0.1.2/python/fim/__init__.py +72 -0
  97. fimage_python-0.1.2/python/fim/_fim.pyi +26 -0
  98. fimage_python-0.1.2/requirements.in +4 -0
  99. fimage_python-0.1.2/requirements_darwin.txt +145 -0
  100. fimage_python-0.1.2/requirements_linux.txt +145 -0
  101. fimage_python-0.1.2/src/image_test.cpp +217 -0
  102. fimage_python-0.1.2/src/integration_test.cpp +377 -0
  103. fimage_python-0.1.2/src/operators/crop_test.cpp +224 -0
  104. fimage_python-0.1.2/src/operators/downsample_test.cpp +248 -0
  105. fimage_python-0.1.2/src/operators/ownership_test.cpp +169 -0
  106. fimage_python-0.1.2/src/operators/paste_test.cpp +300 -0
  107. fimage_python-0.1.2/src/operators/resize_simd.cpp +215 -0
  108. fimage_python-0.1.2/src/operators/resize_test.cpp +302 -0
  109. fimage_python-0.1.2/src/operators/zero_tile_test.cpp +242 -0
  110. fimage_python-0.1.2/src/parallel_performance_test.cpp +485 -0
  111. fimage_python-0.1.2/src/python/BUILD.bazel +63 -0
  112. fimage_python-0.1.2/src/python/_pytest_main.py +60 -0
  113. fimage_python-0.1.2/src/python/associated_images_dict.cpp +130 -0
  114. fimage_python-0.1.2/src/python/bindings.cpp +1035 -0
  115. fimage_python-0.1.2/src/python/checkerboard_integration_test.py +287 -0
  116. fimage_python-0.1.2/src/python/deferred_black_canvas.cpp +58 -0
  117. fimage_python-0.1.2/src/python/fimage_format_test.py +270 -0
  118. fimage_python-0.1.2/src/python/libtiff_context_test.py +57 -0
  119. fimage_python-0.1.2/src/python/multitype_test.py +348 -0
  120. fimage_python-0.1.2/src/python/operator_paste_test.py +359 -0
  121. fimage_python-0.1.2/src/python/operator_resize_test.py +318 -0
  122. fimage_python-0.1.2/src/python/python_bindings_api_test.py +400 -0
  123. fimage_python-0.1.2/src/python/python_integration_test.py +737 -0
  124. fimage_python-0.1.2/src/python/python_stage_validation_test.py +173 -0
  125. fimage_python-0.1.2/src/python/sink_spng_test.py +317 -0
  126. fimage_python-0.1.2/src/sinks/fimage_sink.cpp +277 -0
  127. fimage_python-0.1.2/src/sinks/fimage_sink_test.cpp +506 -0
  128. fimage_python-0.1.2/src/sinks/lodepng_png_sink.cpp +35 -0
  129. fimage_python-0.1.2/src/sinks/lodepng_sink_test.cpp +167 -0
  130. fimage_python-0.1.2/src/sinks/memory_sink.cpp +34 -0
  131. fimage_python-0.1.2/src/sinks/memory_sink_test.cpp +233 -0
  132. fimage_python-0.1.2/src/sinks/move_semantics_test.cpp +267 -0
  133. fimage_python-0.1.2/src/sinks/spng_sink.cpp +55 -0
  134. fimage_python-0.1.2/src/sinks/spng_sink_test.cpp +166 -0
  135. fimage_python-0.1.2/src/sinks/tiff_sink.cpp +144 -0
  136. fimage_python-0.1.2/src/sinks/tiff_sink_test.cpp +312 -0
  137. fimage_python-0.1.2/src/sources/associated_image_source.cpp +169 -0
  138. fimage_python-0.1.2/src/sources/black_source.cpp +74 -0
  139. fimage_python-0.1.2/src/sources/black_source_test.cpp +205 -0
  140. fimage_python-0.1.2/src/sources/fastslide_source.cpp +443 -0
  141. fimage_python-0.1.2/src/sources/fastslide_source_test.cpp +374 -0
  142. fimage_python-0.1.2/src/sources/fimage_source.cpp +541 -0
  143. fimage_python-0.1.2/src/sources/fimage_source_test.cpp +572 -0
  144. fimage_python-0.1.2/src/sources/lodepng_png_source.cpp +217 -0
  145. fimage_python-0.1.2/src/sources/memory_source.cpp +163 -0
  146. fimage_python-0.1.2/src/sources/memory_source_test.cpp +723 -0
  147. fimage_python-0.1.2/src/sources/openslide_source.cpp +456 -0
  148. fimage_python-0.1.2/src/sources/openslide_source_test.cpp +386 -0
  149. fimage_python-0.1.2/src/sources/png_source_test.cpp +367 -0
  150. fimage_python-0.1.2/src/sources/tiff_source.cpp +561 -0
  151. fimage_python-0.1.2/src/sources/tiff_source_test.cpp +173 -0
  152. fimage_python-0.1.2/src/types_test.cpp +400 -0
  153. fimage_python-0.1.2/src/utilities/buffer_pool_test.cpp +253 -0
  154. fimage_python-0.1.2/src/utilities/compressor.cpp +104 -0
  155. fimage_python-0.1.2/src/utilities/compressor_test.cpp +182 -0
  156. fimage_python-0.1.2/src/utilities/decompressor.cpp +104 -0
  157. fimage_python-0.1.2/src/utilities/decompressor_test.cpp +197 -0
  158. fimage_python-0.1.2/subprojects/aifocore.wrap +9 -0
  159. fimage_python-0.1.2/subprojects/cereal.wrap +12 -0
  160. fimage_python-0.1.2/subprojects/fastslide.wrap +11 -0
  161. fimage_python-0.1.2/subprojects/fmt.wrap +13 -0
  162. fimage_python-0.1.2/subprojects/gtest.wrap +16 -0
  163. fimage_python-0.1.2/subprojects/highway.wrap +11 -0
  164. fimage_python-0.1.2/subprojects/jpeg-compressor.wrap +9 -0
  165. fimage_python-0.1.2/subprojects/jxrlib.wrap +9 -0
  166. fimage_python-0.1.2/subprojects/libdicom.wrap +10 -0
  167. fimage_python-0.1.2/subprojects/libjpeg-turbo.wrap +14 -0
  168. fimage_python-0.1.2/subprojects/libopenjp2.wrap +17 -0
  169. fimage_python-0.1.2/subprojects/libpng.wrap +14 -0
  170. fimage_python-0.1.2/subprojects/libtiff.wrap +14 -0
  171. fimage_python-0.1.2/subprojects/lodepng.wrap +14 -0
  172. fimage_python-0.1.2/subprojects/lz4.wrap +13 -0
  173. fimage_python-0.1.2/subprojects/nanobind.wrap +18 -0
  174. fimage_python-0.1.2/subprojects/nlohmann_json.wrap +11 -0
  175. fimage_python-0.1.2/subprojects/packagefiles/lodepng/lodepng/lodepng.h +3 -0
  176. fimage_python-0.1.2/subprojects/packagefiles/lodepng/meson.build +19 -0
  177. fimage_python-0.1.2/subprojects/pugixml.wrap +13 -0
  178. fimage_python-0.1.2/subprojects/robin-map.wrap +16 -0
  179. fimage_python-0.1.2/subprojects/simpletiff.wrap +10 -0
  180. fimage_python-0.1.2/subprojects/spng.wrap +10 -0
  181. fimage_python-0.1.2/subprojects/uthash.wrap +16 -0
  182. fimage_python-0.1.2/subprojects/zlib.wrap +14 -0
  183. fimage_python-0.1.2/subprojects/zstd.wrap +13 -0
  184. fimage_python-0.1.2/tests/README.md +239 -0
  185. fimage_python-0.1.2/third_party/BUILD.bazel +6 -0
  186. fimage_python-0.1.2/third_party/hwy_bazel_includes.patch +15 -0
  187. fimage_python-0.1.2/third_party/libspng.BUILD +23 -0
  188. fimage_python-0.1.2/third_party/libtiff.BUILD +288 -0
  189. fimage_python-0.1.2/third_party/lodepng.BUILD +20 -0
  190. fimage_python-0.1.2/tools/BUILD.bazel +3 -0
  191. fimage_python-0.1.2/tools/artifacts/__init__.py +6 -0
  192. fimage_python-0.1.2/tools/artifacts/common.py +106 -0
  193. fimage_python-0.1.2/tools/artifacts/specs.py +55 -0
  194. fimage_python-0.1.2/tools/artifacts/wheels.py +119 -0
  195. fimage_python-0.1.2/tools/build_wheels.py +62 -0
  196. fimage_python-0.1.2/tools/bump_version.py +253 -0
  197. fimage_python-0.1.2/tools/smoke_test_python.py +42 -0
  198. fimage_python-0.1.2/tools/versioned_py_wheel.bzl +138 -0
@@ -0,0 +1,14 @@
1
+ # Bazel convenience symlinks. Normally these are filtered by Bazel's
2
+ # root-workspace heuristic, but only when fimage IS the root module. When the
3
+ # monorepo loads fimage via `local_path_override`, the heuristic does not apply
4
+ # and `@fimage//...` would otherwise descend into the execroot mirror. Explicit
5
+ # ignores fix that for both contexts.
6
+ bazel-bin
7
+ bazel-out
8
+ bazel-testlogs
9
+ bazel-fimage
10
+ # Leftover Meson subprojects (the standalone repo is Bazel-only for dev; these
11
+ # directories are not generated, but the entry is harmless if absent).
12
+ # NOTE: .bazelignore entries are literal directory paths -- wildcards are not
13
+ # supported and Bazel 9.1+ errors on them (e.g. "Illegal char <*>").
14
+ subprojects
@@ -0,0 +1,76 @@
1
+ # =============================================================================
2
+ # Common Settings
3
+ # =============================================================================
4
+ # Re-enable autoloading for BCR deps (e.g. googletest 1.17.0) that still rely
5
+ # on the legacy native cc_library/cc_test globals removed in Bazel 9.
6
+ build --incompatible_autoload_externally=+@rules_cc,+@rules_python,+@rules_shell
7
+
8
+ common --enable_platform_specific_config
9
+
10
+ # Do NOT auto-synthesize empty __init__.py files into Python runfiles. The
11
+ # legacy behavior turns every directory (including each wheel's `sphinxcontrib/`)
12
+ # into a regular package, which shadows the PEP 420 `sphinxcontrib` namespace
13
+ # shared across the `sphinxcontrib-*` wheels Sphinx depends on.
14
+ build --incompatible_default_to_explicit_init_py
15
+
16
+ # =============================================================================
17
+ # C++ Compiler Settings
18
+ # =============================================================================
19
+ build --cxxopt=-std=c++20
20
+ build --host_cxxopt=-std=c++20
21
+
22
+ # =============================================================================
23
+ # Release Config (opt + strip)
24
+ # =============================================================================
25
+ # Without an explicit compilation_mode, Bazel defaults to `fastbuild` (-O0).
26
+ # Make optimized builds the default here too. Use --config=debug to opt out.
27
+ build:release --compilation_mode=opt
28
+ build:release --copt=-O3
29
+ build:release --copt=-DNDEBUG
30
+ build:release --strip=always
31
+
32
+ build --config=release
33
+ test --config=release
34
+ run --config=release
35
+
36
+ # =============================================================================
37
+ # Debug Config (Opt-in: --config=debug)
38
+ # =============================================================================
39
+ build:debug --compilation_mode=dbg
40
+ build:debug --copt=-O0
41
+ build:debug --copt=-g3
42
+ build:debug --strip=never
43
+ build:debug --copt=-fno-omit-frame-pointer
44
+ build:debug --verbose_failures
45
+
46
+ # =============================================================================
47
+ # Developer Experience
48
+ # =============================================================================
49
+ build --color=yes
50
+ build --show_timestamps
51
+ build --announce_rc
52
+ test --test_output=errors
53
+
54
+ # =============================================================================
55
+ # Sandbox (macOS needs /var/tmp mounted into the sandbox for some toolchains)
56
+ # =============================================================================
57
+ build:macos --sandbox_add_mount_pair=/var/tmp
58
+ build:linux --sandbox_add_mount_pair=/tmp
59
+ build:windows --sandbox_add_mount_pair=C:\Temp
60
+
61
+ # =============================================================================
62
+ # Hermetic Cross-Compilation Config (Opt-in: --config=hermetic)
63
+ # =============================================================================
64
+ # Use --config=hermetic to enable hermetic cross-compilation with Zig.
65
+ # This allows building Linux wheels from macOS and vice versa.
66
+ build:hermetic --extra_toolchains=@zig_sdk//toolchain:linux_amd64_gnu.2.28
67
+ build:hermetic --extra_toolchains=@zig_sdk//toolchain:linux_arm64_gnu.2.28
68
+ build:hermetic --extra_toolchains=@zig_sdk//toolchain:darwin_amd64
69
+ build:hermetic --extra_toolchains=@zig_sdk//toolchain:darwin_arm64
70
+ build:hermetic --extra_toolchains=@zig_sdk//toolchain:windows_amd64
71
+ build:hermetic --extra_toolchains=@zig_sdk//toolchain:windows_arm64
72
+
73
+ # =============================================================================
74
+ # Import Local Settings
75
+ # =============================================================================
76
+ try-import %workspace%/.bazelrc.local
@@ -0,0 +1 @@
1
+ 9.0.0
@@ -0,0 +1,299 @@
1
+ # Build, test, and publish the fimage (fim) Python wheels + sdist to PyPI.
2
+ #
3
+ # Design:
4
+ # - build-wheels: produce each platform's wheels where they CAN be built:
5
+ # * linux/darwin: built with Bazel on a matching runner (darwin_x86_64 is
6
+ # cross-built on the arm64 Mac via the Apple toolchain).
7
+ # * windows_x86_64 / windows_arm64: built NATIVELY on a matching Windows
8
+ # runner (windows-2022 / windows-11-arm) with MSVC via Meson + nanobind +
9
+ # cibuildwheel. All deps compile from source through subprojects/*.wrap
10
+ # and link statically, sidestepping the missing Windows Bazel rules.
11
+ # - build-sdist: platform-independent source distribution (pip falls back to a
12
+ # meson-python source build where no wheel matches).
13
+ # - smoke-wheels: install the freshly built wheel on the real target and run
14
+ # tools/smoke_test_python.py (import + tiny pipeline) for every Python.
15
+ # - publish-pypi / publish-testpypi: upload via Trusted Publishing (OIDC).
16
+ #
17
+ # Unlike fastslide, NO artifacts are attached to a GitHub Release: PyPI is the
18
+ # sole distribution channel for fimage.
19
+ #
20
+ # Trigger: manual only (`workflow_dispatch`). It does NOT run on a version bump.
21
+ name: Release fimage
22
+ on:
23
+ workflow_dispatch:
24
+ inputs:
25
+ release:
26
+ description: "Publish a full release to PyPI (false = TestPyPI snapshot)"
27
+ type: boolean
28
+ default: false
29
+ platforms:
30
+ description: "Comma-separated platform keys to build"
31
+ type: string
32
+ default: "linux_x86_64,linux_arm64,darwin_x86_64,darwin_aarch64,windows_x86_64,windows_arm64"
33
+ permissions:
34
+ contents: read
35
+ concurrency:
36
+ group: release-${{ github.ref }}
37
+ cancel-in-progress: true
38
+ # Force UTF-8 for Python stdio so the build scripts' status glyphs do not crash
39
+ # on Windows runners (default code page is cp1252). Run all JavaScript actions
40
+ # on Node.js 24 (Node.js 20 is deprecated on the runners).
41
+ env:
42
+ PYTHONUTF8: "1"
43
+ PYTHONIOENCODING: "utf-8"
44
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
45
+ jobs:
46
+ build-wheels:
47
+ name: Build wheels ${{ matrix.platform }}
48
+ runs-on: ${{ matrix.builder }}
49
+ strategy:
50
+ fail-fast: false
51
+ matrix:
52
+ # Linux/macOS wheels are built with Bazel (method: bazel). Windows wheels
53
+ # (both amd64 and arm64) are built NATIVELY on a matching Windows runner
54
+ # via Meson + nanobind + cibuildwheel (method: meson). cibw_arch selects
55
+ # the cibuildwheel target arch.
56
+ include:
57
+ - platform: linux_x86_64
58
+ builder: ubuntu-24.04
59
+ method: bazel
60
+ - platform: linux_arm64
61
+ builder: ubuntu-24.04-arm
62
+ method: bazel
63
+ - platform: darwin_x86_64
64
+ builder: macos-14
65
+ method: bazel
66
+ - platform: darwin_aarch64
67
+ builder: macos-14
68
+ method: bazel
69
+ - platform: windows_x86_64
70
+ builder: windows-2022
71
+ method: meson
72
+ cibw_arch: AMD64
73
+ - platform: windows_arm64
74
+ builder: windows-11-arm
75
+ method: meson
76
+ cibw_arch: ARM64
77
+ steps:
78
+ - name: Checkout
79
+ uses: actions/checkout@v5
80
+ - name: Decide whether to build this platform
81
+ id: gate
82
+ shell: bash
83
+ run: |
84
+ selected=",${{ inputs.platforms }},"
85
+ selected="${selected// /}"
86
+ if [[ "${selected}" == *",${{ matrix.platform }},"* ]]; then
87
+ echo "run=true" >> "$GITHUB_OUTPUT"
88
+ else
89
+ echo "run=false (not in inputs.platforms)"
90
+ echo "run=false" >> "$GITHUB_OUTPUT"
91
+ fi
92
+ - name: Free disk space (Linux)
93
+ if: steps.gate.outputs.run == 'true' && runner.os == 'Linux'
94
+ uses: jlumbroso/free-disk-space@v1.3.1
95
+ with:
96
+ android: true
97
+ dotnet: true
98
+ haskell: true
99
+ large-packages: true
100
+ # --- Bazel path (linux/darwin) ---
101
+ - name: Pin Bazel version
102
+ if: steps.gate.outputs.run == 'true' && matrix.method == 'bazel'
103
+ shell: bash
104
+ run: echo "USE_BAZEL_VERSION=$(tr -d '[:space:]' < .bazelversion)" >> "$GITHUB_ENV"
105
+ - name: Set up Bazel
106
+ if: steps.gate.outputs.run == 'true' && matrix.method == 'bazel'
107
+ uses: bazel-contrib/setup-bazel@0.19.0
108
+ with:
109
+ bazelisk-cache: true
110
+ repository-cache: true
111
+ disk-cache: wheels-${{ matrix.platform }}
112
+ - name: Build wheels (${{ matrix.platform }})
113
+ if: steps.gate.outputs.run == 'true' && matrix.method == 'bazel'
114
+ shell: bash
115
+ run: python3 tools/build_wheels.py --platform ${{ matrix.platform }} --bazel bazel
116
+ # --- Native Meson path (windows) ---
117
+ # Windows wheels are compiled on a real Windows host with MSVC. cibuildwheel
118
+ # drives meson-python once per CPython; meson-python reads the forcefallback
119
+ # setup args from pyproject.toml, so every dependency is built from source
120
+ # and linked statically into the self-contained _fim.pyd.
121
+ - name: Build wheels (${{ matrix.platform }})
122
+ if: steps.gate.outputs.run == 'true' && matrix.method == 'meson'
123
+ uses: pypa/cibuildwheel@v3.2.0
124
+ with:
125
+ package-dir: .
126
+ output-dir: artifacts/wheels
127
+ env:
128
+ # cp310 has no official Windows ARM64 CPython; cibuildwheel skips it
129
+ # there automatically, so the same build set is safe for both arches.
130
+ CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
131
+ CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_arch }}
132
+ CIBW_BUILD_VERBOSITY: "1"
133
+ # Force MSVC. The windows runner images ship MinGW GCC on PATH, and
134
+ # Meson's auto-detection would otherwise pick that `cc` over MSVC.
135
+ # `--vsenv` makes Meson activate the Visual Studio environment.
136
+ CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv"
137
+ - name: Upload wheels
138
+ if: steps.gate.outputs.run == 'true'
139
+ uses: actions/upload-artifact@v6
140
+ with:
141
+ name: wheels-${{ matrix.platform }}
142
+ path: artifacts/wheels/*.whl
143
+ if-no-files-found: error
144
+ retention-days: 7
145
+ build-sdist:
146
+ # The source distribution is platform-independent and is what
147
+ # `pip install fimage-python` falls back to on any platform/Python without a
148
+ # prebuilt wheel: pip builds it from source via meson-python, where
149
+ # --wrap-mode=forcefallback (from pyproject.toml) fetches every dependency
150
+ # through subprojects/*.wrap and links it statically.
151
+ name: Build sdist
152
+ runs-on: ubuntu-24.04
153
+ steps:
154
+ - name: Checkout
155
+ uses: actions/checkout@v5
156
+ - name: Set up uv
157
+ uses: astral-sh/setup-uv@v6
158
+ - name: Build sdist
159
+ shell: bash
160
+ run: uv build --sdist --out-dir artifacts/sdist
161
+ - name: Upload sdist
162
+ uses: actions/upload-artifact@v6
163
+ with:
164
+ name: sdist
165
+ path: artifacts/sdist/*.tar.gz
166
+ if-no-files-found: error
167
+ retention-days: 7
168
+ smoke-wheels:
169
+ name: Smoke wheel ${{ matrix.target.platform }} py${{ matrix.python }}
170
+ needs: build-wheels
171
+ runs-on: ${{ matrix.target.runner }}
172
+ strategy:
173
+ fail-fast: false
174
+ matrix:
175
+ python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
176
+ target:
177
+ - platform: linux_x86_64
178
+ runner: ubuntu-24.04
179
+ - platform: linux_arm64
180
+ runner: ubuntu-24.04-arm
181
+ # x86_64 wheel runs under Rosetta on the arm64 mac with an x86_64
182
+ # CPython (uv downloads the matching build).
183
+ - platform: darwin_x86_64
184
+ runner: macos-14
185
+ rosetta: true
186
+ - platform: darwin_aarch64
187
+ runner: macos-14
188
+ - platform: windows_x86_64
189
+ runner: windows-2022
190
+ - platform: windows_arm64
191
+ runner: windows-11-arm
192
+ # No official CPython 3.10 for Windows ARM64, so no cp310 win_arm64 wheel
193
+ # is built; drop that smoke combination.
194
+ exclude:
195
+ - python: "3.10"
196
+ target:
197
+ platform: windows_arm64
198
+ steps:
199
+ - name: Checkout
200
+ uses: actions/checkout@v5
201
+ - name: Decide whether to smoke this platform
202
+ id: gate
203
+ shell: bash
204
+ run: |
205
+ selected=",${{ inputs.platforms }},"
206
+ selected="${selected// /}"
207
+ if [[ "${selected}" == *",${{ matrix.target.platform }},"* ]]; then
208
+ echo "run=true" >> "$GITHUB_OUTPUT"
209
+ else
210
+ echo "run=false" >> "$GITHUB_OUTPUT"
211
+ fi
212
+ - name: Install Rosetta
213
+ if: steps.gate.outputs.run == 'true' && matrix.target.rosetta
214
+ run: softwareupdate --install-rosetta --agree-to-license
215
+ - name: Set up uv
216
+ if: steps.gate.outputs.run == 'true'
217
+ uses: astral-sh/setup-uv@v6
218
+ - name: Download wheels
219
+ if: steps.gate.outputs.run == 'true'
220
+ uses: actions/download-artifact@v6
221
+ with:
222
+ path: dist
223
+ pattern: "wheels-*"
224
+ merge-multiple: true
225
+ # Build a venv on the right interpreter (x86_64 CPython for the Rosetta
226
+ # leg), install the local wheel under test (uv picks the dist wheel whose
227
+ # tags match the venv's Python/arch), and run the import + pipeline smoke.
228
+ # --find-links dist makes the local wheel the source for fimage-python,
229
+ # while the index supplies its runtime dep (numpy).
230
+ - name: Import + pipeline smoke (${{ matrix.target.platform }} py${{ matrix.python }})
231
+ if: steps.gate.outputs.run == 'true'
232
+ shell: bash
233
+ run: |
234
+ set -euo pipefail
235
+ pyreq="${{ matrix.python }}"
236
+ if [ "${{ matrix.target.rosetta }}" = "true" ]; then
237
+ pyreq="cpython-${{ matrix.python }}-macos-x86_64"
238
+ fi
239
+ uv python install "$pyreq"
240
+ uv venv --python "$pyreq" .venv
241
+ if [ "${{ runner.os }}" = "Windows" ]; then
242
+ py=".venv/Scripts/python.exe"
243
+ else
244
+ py=".venv/bin/python"
245
+ fi
246
+ uv pip install --python "$py" --find-links dist fimage-python
247
+ "$py" tools/smoke_test_python.py
248
+ publish-pypi:
249
+ name: Publish wheels + sdist to PyPI
250
+ # Full release -> real PyPI. Only after the wheels pass their smoke tests.
251
+ # The sdist is uploaded alongside the wheels so pip can fall back to a source
252
+ # build on any platform without a prebuilt wheel.
253
+ if: inputs.release == true
254
+ needs: [smoke-wheels, build-sdist]
255
+ runs-on: ubuntu-24.04
256
+ environment: pypi
257
+ permissions:
258
+ id-token: write # OIDC for PyPI Trusted Publishing (no API token)
259
+ steps:
260
+ - name: Download wheels + sdist
261
+ uses: actions/download-artifact@v6
262
+ with:
263
+ path: dist
264
+ pattern: "{wheels-*,sdist}"
265
+ merge-multiple: true
266
+ - name: List distributions
267
+ shell: bash
268
+ run: ls -l dist
269
+ - name: Publish to PyPI
270
+ uses: pypa/gh-action-pypi-publish@release/v1
271
+ with:
272
+ packages-dir: dist
273
+ skip-existing: true
274
+ publish-testpypi:
275
+ name: Publish wheels + sdist to TestPyPI
276
+ # Snapshot -> TestPyPI, so the publish path is exercised without touching the
277
+ # real index (re-runs of the same version are no-ops thanks to skip-existing).
278
+ if: inputs.release == false
279
+ needs: [smoke-wheels, build-sdist]
280
+ runs-on: ubuntu-24.04
281
+ environment: testpypi
282
+ permissions:
283
+ id-token: write
284
+ steps:
285
+ - name: Download wheels + sdist
286
+ uses: actions/download-artifact@v6
287
+ with:
288
+ path: dist
289
+ pattern: "{wheels-*,sdist}"
290
+ merge-multiple: true
291
+ - name: List distributions
292
+ shell: bash
293
+ run: ls -l dist
294
+ - name: Publish to TestPyPI
295
+ uses: pypa/gh-action-pypi-publish@release/v1
296
+ with:
297
+ packages-dir: dist
298
+ repository-url: https://test.pypi.org/legacy/
299
+ skip-existing: true
@@ -0,0 +1,19 @@
1
+ builddir/
2
+ node_modules/
3
+ artifacts/
4
+
5
+ # Meson subprojects: commit only the wrap files and the vendored packagefiles
6
+ # (meson.build overlays + header shims). Everything else under subprojects/ is
7
+ # either downloaded/extracted dependency sources, the package cache, or local
8
+ # dev symlinks, none of which should be tracked.
9
+ subprojects/*
10
+ !subprojects/*.wrap
11
+ !subprojects/packagefiles/
12
+ # Meson auto-generates this [wrap-redirect] into libdicom's nested check.wrap
13
+ # whenever libdicom is extracted. It points at subprojects/libdicom-1.3.0/...,
14
+ # which does not exist on a fresh checkout, so committing it makes `meson setup`
15
+ # abort with "wrap-redirect ... filename does not exist" (validated eagerly,
16
+ # before -Dlibdicom:tests=false can take effect). `check` is only libdicom's
17
+ # test dependency, which we never build, so this redirect is pure build-time
18
+ # noise -- keep it untracked.
19
+ subprojects/check.wrap