Skip to content

Instantly share code, notes, and snippets.

@zachlewis
zachlewis / README.md
Created April 15, 2025 20:10
oiio_wheels_repair example

Example of using custom CIBW repair-wheel-command to invoke "stub_generation.py" (not included, assumed to be in the same directory as the "oiio_wheels_repair.py" file

Here's what happens:

  1. Just before the build initializes, uv is installed to the local CIBW instance.
  2. The wheel is built as normal...
  3. We use uv run --no-config to run our custom script: A. The cross-platform repairwheel utility produces a "repaired" wheel consistent with what CIBW normally does if you don't specify a custom repair-wheel-command B. (Optionally, we strip out stuff we know we don't want -- this isn't doing much now, but if/when we start bundling dynamic (e.g. LGPL) libraries with the distribution, we'll want to strip out redundant "namelink copies" of shared libs to reduce wheel file size) C. Invoke the stub_generator.py script with uv run --with --no-config stub_generator.py
@zachlewis
zachlewis / README.md
Created April 14, 2025 20:08
Example wheel patch script

Example of a script to patch wheels run during the cibuildwheel repair-wheel step

ocio_profile_version: 2.2
name: example-egamut2-config_v1.0
description: |
Demonstrates the use of EGamut2 D65 as the scene reference space and the rest of the display color space / view transform architecture
search_path:
- ./luts
@zachlewis
zachlewis / package.py
Last active February 22, 2025 16:46
Rez package for Boost
name = 'boost'
version = "1.85.0"
authors = ['boost.org']
hased_variants= True
description = \
'''
@zachlewis
zachlewis / patch_cicp.py
Last active February 26, 2025 15:28
Patch nclx data into AVIF file header for specified Primaries / TRC / YUV Matrix
import binascii
import os
import re
from logging import getLogger
logger = getLogger(__name__)
def patch_avif_header_cicp(input_file, P=9, T=16, M=9, output_file=None, preset=None, dryrun=False):
"""Patch nclx data into AVIF file header for specified Primaries / TRC / YUV Matrix Coeff enums."""
@zachlewis
zachlewis / package.py
Created May 10, 2024 01:19
rust rez package.py
name = 'rust'
version = '1.78.0'
description = 'Rust is an interpreted, interactive, object-oriented programming language'
help = "https://www.rust-lang.org"
@early()
def uuid():
@zachlewis
zachlewis / package.py
Last active May 10, 2024 01:39
python rez package.py that uses `rye` to download and deploy indygreg builds
name = "python"
version = "3.10.14"
authors = ["Guido van Rossum"]
description = "The Python programming language"
@early()
def variants():
import rez.package_py_utils as rezutils, platform
p = 'platform-%s' % {'darwin':'osx','windows':'windows','linux':'linux'}[platform.system().lower()]
return [rezutils.expand_requires(p, "arch-**")]
@zachlewis
zachlewis / NumericLookup.py
Last active May 23, 2022 22:31
NumericLookup
import numpy as np
class NumericLookup(dict):
"""
Extends *dict* type to provide a lookup by value(s), including numpy arrays.
Methods
-------
keys_from_value
first_key_from_value
@zachlewis
zachlewis / aces_ot_candidates_ocio_config.ipynb
Last active September 22, 2023 12:19
ACES_OT_Candidates_ocio_config.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zachlewis
zachlewis / set_ocio_transform_metadata.py
Created November 29, 2021 16:31
PyOpenColorIO format metadata method
import PyOpenColorIO as ocio
from typing import Union, List
def set_transform_metadata(
transform: ocio.Transform,
name: str = "",
id: str = "",
description: Union[str, List[str]] = "",
input_descriptor: str = "",
output_descriptor: str = "",