Skip to content
Open
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
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
python-version: ["3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -387,7 +387,7 @@ jobs:
runs-on: ubuntu-24.04-arm
strategy:
matrix:
python: ["3.11", "3.12", "3.13"]
python: ["3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -434,7 +434,6 @@ jobs:
container: off
manylinux: manylinux_2_39
env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
LIBCLANG_PATH: ${{ env.LIBCLANG_PATH }}
LLVM_CONFIG_PATH: ${{ env.LLVM_CONFIG_PATH }}
OPENCV_INCLUDE_PATHS: ${{ github.workspace }}/third_party/opencv-static/include/opencv4
Expand Down
38 changes: 30 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
target: x86_64
manylinux: manylinux_2_35
python: '3.13'
- os: ubuntu-22.04
target: x86_64
manylinux: manylinux_2_35
python: '3.14'
# Ubuntu 24.04 (libc 2.39)
- os: ubuntu-24.04
target: x86_64
Expand All @@ -38,6 +42,10 @@ jobs:
target: x86_64
manylinux: manylinux_2_39
python: '3.13'
- os: ubuntu-24.04
target: x86_64
manylinux: manylinux_2_39
python: '3.14'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down Expand Up @@ -104,8 +112,6 @@ jobs:
container: off
manylinux: ${{ matrix.manylinux }}
env:
# Use stable ABI for forward compatibility
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
# LLVM for opencv-rust bindings (from earlier install step)
LIBCLANG_PATH: ${{ env.LIBCLANG_PATH }}
LLVM_CONFIG_PATH: ${{ env.LLVM_CONFIG_PATH }}
Expand Down Expand Up @@ -135,7 +141,7 @@ jobs:
runs-on: ubuntu-24.04-arm
strategy:
matrix:
python: ['3.11', '3.12', '3.13']
python: ['3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down Expand Up @@ -186,8 +192,6 @@ jobs:
container: off
manylinux: manylinux_2_39
env:
# Use stable ABI for forward compatibility
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
# LLVM for opencv-rust bindings (from earlier install step)
LIBCLANG_PATH: ${{ env.LIBCLANG_PATH }}
LLVM_CONFIG_PATH: ${{ env.LLVM_CONFIG_PATH }}
Expand Down Expand Up @@ -217,7 +221,7 @@ jobs:
strategy:
matrix:
target: [aarch64]
python: ['3.11', '3.12', '3.13']
python: ['3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down Expand Up @@ -251,8 +255,6 @@ jobs:
args: --release --out dist -i python --no-default-features --features python-bindings,simd,opencv,metal
sccache: 'false'
env:
# Use stable ABI for forward compatibility
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
# OpenCV static linking configuration
OPENCV_INCLUDE_PATHS: ${{ github.workspace }}/third_party/opencv-static/include/opencv4
OPENCV_LINK_PATHS: ${{ github.workspace }}/third_party/opencv-static/lib
Expand Down Expand Up @@ -306,6 +308,11 @@ jobs:
manylinux: manylinux_2_35
python: '3.13'
artifact_name: wheels-ubuntu-22.04-x86_64-py3.13
- os: ubuntu-22.04
target: x86_64
manylinux: manylinux_2_35
python: '3.14'
artifact_name: wheels-ubuntu-22.04-x86_64-py3.14
# Ubuntu 24.04 (libc 2.39)
- os: ubuntu-24.04
target: x86_64
Expand All @@ -322,6 +329,11 @@ jobs:
manylinux: manylinux_2_39
python: '3.13'
artifact_name: wheels-ubuntu-24.04-x86_64-py3.13
- os: ubuntu-24.04
target: x86_64
manylinux: manylinux_2_39
python: '3.14'
artifact_name: wheels-ubuntu-24.04-x86_64-py3.14
# Linux aarch64 (DGX Spark / GB10)
- os: ubuntu-24.04-arm
target: aarch64
Expand All @@ -338,6 +350,11 @@ jobs:
manylinux: manylinux_2_39
python: '3.13'
artifact_name: wheels-linux-aarch64-py3.13
- os: ubuntu-24.04-arm
target: aarch64
manylinux: manylinux_2_39
python: '3.14'
artifact_name: wheels-linux-aarch64-py3.14
# macOS aarch64
- os: macos-latest
target: aarch64
Expand All @@ -354,6 +371,11 @@ jobs:
manylinux: ''
python: '3.13'
artifact_name: wheels-macos-latest-aarch64-py3.13
- os: macos-latest
target: aarch64
manylinux: ''
python: '3.14'
artifact_name: wheels-macos-latest-aarch64-py3.14
steps:
- uses: actions/download-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Cargo.lock
# Static OpenCV bundle (built in CI, not committed)
third_party/
opencv-build-tmp/
ffmpeg-build-tmp/

files.tbz
*/config/auth.json
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ image = {version = "0.25", features = ["png", "jpeg", "webp"]}
imageproc = "0.25"
# Metal GPU acceleration
metal = {version = "0.27", optional = true}
ndarray = "0.16"
ndarray = "0.17"
num_cpus = "1.16"
numpy = {version = "0.22", optional = true}
numpy = {version = "0.27", optional = true}
objc = {version = "0.2", optional = true}
# OpenCV bindings for performance parity
# Limit binding generation to the modules this crate actually uses.
opencv = {version = "0.99", optional = true, default-features = false, features = ["clang-runtime", "imgproc", "videoio"]}
# Python bindings (optional)
pyo3 = {version = "0.22", features = ["extension-module"], optional = true}
pyo3 = {version = "0.27", features = ["extension-module"], optional = true}
rayon = "1.8"
tempfile = {version = "3.10", optional = true}
# SIMD optimizations
Expand All @@ -39,7 +39,7 @@ description = "High-performance Rust reimplementation of GIL-blocking video/imag
edition = "2021"
license = "MIT"
name = "trainingsample"
version = "0.3.1"
version = "0.3.2"

[profile.release]
codegen-units = 1
Expand Down
11 changes: 11 additions & 0 deletions docs/BUILDING_STATIC_OPENCV.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ C and C++ compilers
CI also installs clang, libclang, LLVM, nasm, and yasm before running the
script.

On macOS, install the same build dependencies used by CI before running the
script:

```bash
brew install llvm cmake nasm pkg-config
```

The script isolates its pinned FFmpeg build from other Homebrew libraries, so
an existing Homebrew OpenCV or FFmpeg installation does not affect the static
bundle.

## Output

| Path | Contents |
Expand Down
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
build-backend = "maturin"
requires = ["maturin>=1.0,<2.0"]
requires = ["maturin>=1.9.5,<2.0"]

[project]
authors = [{name = "bghira", email = "bghira@users.noreply.github.com"}]
Expand All @@ -10,17 +10,18 @@ classifiers = [
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13"
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14"
]
dependencies = ["numpy>=1.21.0", "pillow>=8.0.0"]
description = "High-performance Rust reimplementation of GIL-blocking video/image operations"
license = {text = "MIT"}
name = "trainingsample"
requires-python = ">=3.11"
version = "0.3.1"
version = "0.3.2"

[project.optional-dependencies]
dev = ["pytest>=6.0", "pytest-benchmark", "maturin>=1.0,<2.0", "pre-commit"]
dev = ["pytest>=6.0", "pytest-benchmark", "maturin>=1.9.5,<2.0", "pre-commit"]

[tool.black]
extend-exclude = '''
Expand Down
16 changes: 15 additions & 1 deletion scripts/build-opencv-static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ fi

# Configure CMake build
echo "Configuring CMake build..."
export PKG_CONFIG_PATH="${FFMPEG_INSTALL_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
export PKG_CONFIG_PATH="${FFMPEG_INSTALL_DIR}/lib/pkgconfig"
export PKG_CONFIG_LIBDIR="${FFMPEG_INSTALL_DIR}/lib/pkgconfig"

# Always configure from a clean CMake cache. A failed build may leave cached
# host dependency paths behind, which can otherwise poison subsequent retries.
rm -rf "${BUILD_DIR}/build"

CMAKE_ARGS=(
-S "opencv-${OPENCV_VERSION}"
Expand Down Expand Up @@ -179,6 +184,15 @@ CMAKE_ARGS=(
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
)

# Keep Homebrew libraries from leaking into the pinned static bundle. In
# particular, OpenCV must compile against the FFmpeg headers built above, not
# a newer Homebrew FFmpeg while linking the pinned static archives.
if [[ "$(uname)" == "Darwin" ]] && command -v brew >/dev/null 2>&1; then
CMAKE_ARGS+=(
-DCMAKE_IGNORE_PREFIX_PATH="$(brew --prefix)"
)
fi

# Disable Carotene (ARM NEON optimizations) to avoid undefined symbol errors
# when statically linking. Carotene requires runtime library that isn't bundled.
if [[ "$(uname)" == "Darwin" ]] || [[ "$(uname -m)" == "aarch64" ]] || [[ "$(uname -m)" == "arm64" ]]; then
Expand Down
Loading
Loading