Skip to content

Commit 47594e8

Browse files
committed
Merge branch 'main' of github.com:AcademySoftwareFoundation/OpenImageIO into 4632_rust_bindings
2 parents 5c84522 + 7f4c1b3 commit 47594e8

File tree

72 files changed

+4154
-2538
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4154
-2538
lines changed

.github/workflows/build-steps.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ jobs:
104104
steps:
105105
- name: Checkout repo
106106
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
107-
with:
108-
fetch-depth: '0'
109107
- name: Prepare ccache timestamp
110108
id: ccache_cache_keys
111109
shell: bash

.github/workflows/ci.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ jobs:
176176
# egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
177177
- name: Checkout repo
178178
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
179-
with:
180-
fetch-depth: '0'
181179
- name: Prepare ccache timestamp
182180
id: ccache_cache_keys
183181
run: echo "date=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" >> $GITHUB_OUTPUT
@@ -340,7 +338,16 @@ jobs:
340338
fmt_ver: 10.1.1
341339
pybind11_ver: v2.12.0
342340
setenvs: PUGIXML_VERSION=v1.14
343-
- desc: VFX2024 sanitizers
341+
- desc: VFX2025 gcc11/C++17 py3.11 exr3.3 ocio2.4
342+
nametag: linux-vfx2025
343+
runner: ubuntu-latest
344+
container: aswftesting/ci-oiio:2025
345+
python_ver: "3.11"
346+
simd: "avx2,f16c"
347+
fmt_ver: 11.1.4
348+
pybind11_ver: v2.13.6
349+
setenvs: PUGIXML_VERSION=v1.15
350+
- desc: Sanitizers
344351
nametag: sanitizer
345352
runner: ubuntu-latest
346353
container: aswf/ci-osl:2024-clang17
@@ -367,7 +374,7 @@ jobs:
367374
simd: "avx2,f16c"
368375
skip_tests: 1
369376
# abi_check: v2.6.2.0
370-
abi_check: 730687ae79bb6c3290afff535aa0e98b0531d165
377+
abi_check: b35615200396c4767966446e446b4fe5ad960d2a
371378
setenvs: export OIIO_CMAKE_FLAGS="-DOIIO_BUILD_TOOLS=0 -DOIIO_BUILD_TESTS=0 -DUSE_PYTHON=0"
372379
USE_OPENCV=0 USE_FFMPEG=0 USE_PYTHON=0 USE_FREETYPE=0
373380

@@ -397,7 +404,7 @@ jobs:
397404
cc_compiler: gcc-13
398405
cxx_compiler: g++-13
399406
cxx_std: 20
400-
fmt_ver: 11.1.4
407+
fmt_ver: 11.2.0
401408
opencolorio_ver: v2.4.2
402409
openexr_ver: v3.3.3
403410
pybind11_ver: v2.13.6
@@ -608,3 +615,9 @@ jobs:
608615
generator: "Visual Studio 17 2022"
609616
python_ver: "3.9"
610617
setenvs: export OPENIMAGEIO_PYTHON_LOAD_DLLS_FROM_PATH=1
618+
- desc: Windows-2025 VS2022
619+
runner: windows-2025
620+
vsver: 2022
621+
generator: "Visual Studio 17 2022"
622+
python_ver: "3.9"
623+
setenvs: export OPENIMAGEIO_PYTHON_LOAD_DLLS_FROM_PATH=1

.github/workflows/release-sign.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ jobs:
4848
echo OPENIMAGEIO_TARBALL=OpenImageIO-${TAG//v}.tar.gz >> $GITHUB_ENV
4949
shell: bash
5050

51-
- name: Checkout
52-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
51+
- name: Checkout repo
52+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5353

5454
- name: Create archive
5555
run: git archive --format=tar.gz -o ${OPENIMAGEIO_TARBALL} --prefix ${OPENIMAGEIO_PREFIX} ${TAG}

.github/workflows/scorecard.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ jobs:
4040
actions: read
4141

4242
steps:
43-
- name: "Checkout code"
43+
- name: Checkout repo
4444
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4545
with:
4646
persist-credentials: false
47-
fetch-depth: '0'
4847

4948
- name: "Run analysis"
5049
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
@@ -66,7 +65,7 @@ jobs:
6665
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
6766
# format to the repository Actions tab.
6867
- name: "Upload artifact"
69-
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
68+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
7069
with:
7170
name: SARIF file
7271
path: results.sarif

.github/workflows/wheel.yml

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,16 @@ jobs:
5858
5959
steps:
6060

61-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
61+
- name: Checkout repo
62+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6263

6364
- name: Build SDist
6465
run: pipx run build --sdist
6566

6667
- name: Check metadata
6768
run: pipx run twine check dist/*
6869

69-
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
70+
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
7071
with:
7172
name: cibw-sdist
7273
path: dist/*.tar.gz
@@ -140,24 +141,33 @@ jobs:
140141
arch: x86_64
141142

142143
steps:
143-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
144+
- name: Checkout repo
145+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
144146

145-
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
146-
name: Install Python
147+
- name: Install Python
148+
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
147149
with:
148150
python-version: '3.9'
149151

150152
- name: Build wheels
153+
# Note: the version of cibuildwheel should be kept in sync with src/python/stubs/CMakeLists.txt
151154
uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.1
152155
env:
156+
# pass GITHUB_ACTIONS through to the build container so that custom
157+
# processes can tell they are running in CI.
158+
CIBW_ENVIRONMENT_PASS_LINUX: GITHUB_ACTIONS
153159
CIBW_BUILD: ${{ matrix.python }}
154160
CIBW_ARCHS: ${{ matrix.arch }}
155161
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }}
156162

157-
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
163+
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
158164
with:
159165
name: cibw-wheels-${{ matrix.python }}-${{ matrix.manylinux }}
160-
path: ./wheelhouse/*.whl
166+
path: |
167+
./wheelhouse/*.whl
168+
./wheelhouse/OpenImageIO/__init__.pyi
169+
# if stub validation fails we want to upload the stubs for users to review
170+
if: success() || failure()
161171

162172
# ---------------------------------------------------------------------------
163173
# Linux ARM Wheels
@@ -201,10 +211,11 @@ jobs:
201211
arch: aarch64
202212

203213
steps:
204-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
214+
- name: Checkout repo
215+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
205216

206-
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
207-
name: Install Python
217+
- name: Install Python
218+
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
208219
with:
209220
python-version: '3.9'
210221

@@ -215,10 +226,14 @@ jobs:
215226
CIBW_ARCHS: ${{ matrix.arch }}
216227
CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.manylinux }}
217228

218-
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
229+
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
219230
with:
220231
name: cibw-wheels-${{ matrix.python }}-${{ matrix.manylinux }}
221-
path: ./wheelhouse/*.whl
232+
path: |
233+
./wheelhouse/*.whl
234+
./wheelhouse/OpenImageIO/__init__.pyi
235+
# if stub validation fails we want to upload the stubs for users to review
236+
if: success() || failure()
222237

223238
# ---------------------------------------------------------------------------
224239
# macOS Wheels
@@ -256,10 +271,11 @@ jobs:
256271
arch: x86_64
257272

258273
steps:
259-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
274+
- name: Checkout repo
275+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
260276

261-
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
262-
name: Install Python
277+
- name: Install Python
278+
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
263279
with:
264280
python-version: '3.9'
265281

@@ -273,7 +289,7 @@ jobs:
273289
# not include GPL-licensed dynamic libraries.
274290
USE_Libheif: 'OFF'
275291

276-
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
292+
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
277293
with:
278294
name: cibw-wheels-${{ matrix.python }}
279295
path: ./wheelhouse/*.whl
@@ -314,10 +330,11 @@ jobs:
314330
arch: arm64
315331

316332
steps:
317-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
333+
- name: Checkout repo
334+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
318335

319-
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
320-
name: Install Python
336+
- name: Install Python
337+
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
321338
# https://cibuildwheel.pypa.io/en/stable/faq/#macos-building-cpython-38-wheels-on-arm64
322339
with:
323340
python-version: '3.8'
@@ -330,7 +347,7 @@ jobs:
330347
CIBW_ARCHS: ${{ matrix.arch }}
331348
CMAKE_GENERATOR: "Unix Makefiles"
332349

333-
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
350+
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
334351
with:
335352
name: cibw-wheels-${{ matrix.python }}
336353
path: ./wheelhouse/*.whl
@@ -371,10 +388,11 @@ jobs:
371388
arch: AMD64
372389

373390
steps:
374-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
391+
- name: Checkout repo
392+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
375393

376-
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
377-
name: Install Python
394+
- name: Install Python
395+
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
378396
with:
379397
python-version: '3.9'
380398

@@ -385,7 +403,7 @@ jobs:
385403
CIBW_ARCHS: ${{ matrix.arch }}
386404
CMAKE_POLICY_VERSION_MINIMUM: 3.5
387405

388-
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
406+
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
389407
with:
390408
name: cibw-wheels-${{ matrix.python }}
391409
path: ./wheelhouse/*.whl

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
cmake_minimum_required (VERSION 3.18.2...4.0)
66

7-
set (OpenImageIO_VERSION "3.1.1.0")
7+
set (OpenImageIO_VERSION "3.1.2.0")
88
set (OpenImageIO_VERSION_OVERRIDE "" CACHE STRING
99
"Version override (use with caution)!")
1010
mark_as_advanced (OpenImageIO_VERSION_OVERRIDE)

INSTALL.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
7474
* Ptex >= 2.3.1 (probably works for older; tested through 2.4.3)
7575
* If you want to be able to do font rendering into images:
7676
* Freetype >= 2.10.0 (tested through 2.13)
77+
* If you want to be able to read "ultra-HDR" embedded in JPEG files:
78+
* libultrahdr >= 1.3 (tested through 1.4)
7779
* We use PugiXML for XML parsing. There is a version embedded in the OIIO
7880
tree, but if you want to use an external, system-installed version (as
7981
may be required by some software distributions with policies against
@@ -393,6 +395,25 @@ the headers, and the CLI tools to a platform-specific, Python-specific location.
393395
See the [scikit-build-core docs](https://scikit-build-core.readthedocs.io/en/latest/configuration.html#configuring-cmake-arguments-and-defines)
394396
for more information on customizing and overriding build-tool options and CMake arguments.
395397

398+
This repo contains python type stubs which are generated from `pybind11` signatures.
399+
The workflow for releasing new stubs is as follows:
400+
401+
- Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) and `docker`
402+
- Run `make pystubs` locally to generate updated stubs in `src/python/stubs/__init__.pyi`
403+
- Run `make test-pystubs` locally to use mypy to test the stubs against the code in
404+
the python testsuite.
405+
- Commit the new stubs and push to Github
406+
- In CI, the stubs will be included in the wheels built by `cibuildwheel`, as defined in `.github/wheel.yml`
407+
- In CI, one of the `cibuildwheel` Github actions will rebuild the stubs to a
408+
temp location and verify that they match what has been committed to the repo.
409+
This step ensures that if changes to the C++ source code and bindings results
410+
in a change to the stubs, developers are notified of the need to regenerate
411+
the stubs, so that changes can be reviewed and the rules in `generate_stubs.py`
412+
can be updated, if necessary.
413+
414+
Note that if you can't (or don't want to) build the stubs locally, you can
415+
download an artifact containing the wheel and `__init__.pyi` file from any job
416+
that fails the stub validation.
396417

397418
Test Images
398419
-----------

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,18 @@ build: config
243243
${CMAKE} --build . --config ${CMAKE_BUILD_TYPE} \
244244
)
245245

246+
# generate python stubs and add them to the repo
247+
pystubs: config
248+
@ ( cd ${build_dir} ; \
249+
${CMAKE} --build . --config ${CMAKE_BUILD_TYPE} --target pystubs \
250+
)
251+
252+
# run mypy on python tests to confirm the stubs are working
253+
test-pystubs: pystubs
254+
@ ( uv export --quiet --no-dev --no-build --no-emit-project --no-hashes -o ${build_dir}/requirements.txt ; \
255+
uvx --with-requirements ${build_dir}/requirements.txt mypy==1.15.0 \
256+
)
257+
246258
# 'make install' builds everthing and installs it in 'dist'.
247259
# Suppress pointless output from docs installation.
248260
install: build

pyproject.toml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,31 @@ CXXFLAGS = "-Wno-error=stringop-overflow -Wno-pragmas"
122122
SKBUILD_CMAKE_BUILD_TYPE = "MinSizeRel"
123123

124124
[tool.cibuildwheel.windows.environment]
125-
SKBUILD_CMAKE_BUILD_TYPE = "MinSizeRel"
125+
SKBUILD_CMAKE_BUILD_TYPE = "MinSizeRel"
126+
127+
[[tool.cibuildwheel.overrides]]
128+
# Trigger the build & validation of the python stubs for certain platforms.
129+
# The test command acts as a kind of "post-build" callback where it's possible
130+
# for the stub-generator to import the freshly-built wheel.
131+
# There are two entry-points which are designed to call generate_stubs.py through
132+
# this test command:
133+
# - `make pystubs` is called during local development to generate the
134+
# stubs and copy them into the git repo to be committed and reviewed.
135+
# - in CI, the cibuildwheel action is used to validate that the stubs match what
136+
# has been committed to the repo.
137+
test-requires = "mypy~=1.15.0 stubgenlib~=0.1.0"
138+
# Note: the python version here must be kept in sync with src/python/stubs/CMakeLists.txt
139+
select = "cp311-manylinux_*64"
140+
inherit.test-command = "append"
141+
test-command = [
142+
"python {project}/src/python/stubs/generate_stubs.py --out-path '/output' --validate-path '{project}/src/python/stubs/OpenImageIO/__init__.pyi'",
143+
]
144+
145+
[tool.mypy]
146+
files = [
147+
"testsuite/python-*/src/",
148+
]
149+
mypy_path = [
150+
"src/python/stubs",
151+
]
152+
check_untyped_defs = true

src/build-scripts/install_homebrew_deps.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ brew link --overwrite --force python@${PYTHON_VERSION} || true
3939
#brew install --display-times -q libtiff
4040
brew install --display-times -q imath openexr opencolorio
4141
#brew install --display-times -q libpng giflib webp
42-
brew install --display-times -q jpeg-turbo openjpeg
42+
brew install --display-times -q jpeg-turbo openjpeg libultrahdr
4343
brew install --display-times -q freetype libraw dcmtk pybind11 numpy || true
4444
brew install --display-times -q ffmpeg libheif ptex || true
4545
brew install --display-times -q tbb || true

0 commit comments

Comments
 (0)