trainingsample 0.2.17__tar.gz → 0.3.0__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 (42) hide show
  1. {trainingsample-0.2.17 → trainingsample-0.3.0}/.github/workflows/ci.yml +61 -54
  2. {trainingsample-0.2.17 → trainingsample-0.3.0}/.github/workflows/publish.yml +1 -1
  3. {trainingsample-0.2.17 → trainingsample-0.3.0}/Cargo.lock +210 -340
  4. {trainingsample-0.2.17 → trainingsample-0.3.0}/Cargo.toml +2 -2
  5. {trainingsample-0.2.17 → trainingsample-0.3.0}/PKG-INFO +1 -1
  6. {trainingsample-0.2.17 → trainingsample-0.3.0}/pyproject.toml +1 -1
  7. {trainingsample-0.2.17 → trainingsample-0.3.0}/src/cropping.rs +34 -15
  8. {trainingsample-0.2.17 → trainingsample-0.3.0}/src/opencv_ops.rs +110 -66
  9. {trainingsample-0.2.17 → trainingsample-0.3.0}/src/python_bindings.rs +18 -18
  10. {trainingsample-0.2.17 → trainingsample-0.3.0}/src/tests.rs +11 -0
  11. {trainingsample-0.2.17 → trainingsample-0.3.0}/tests/comprehensive_tests.rs +40 -26
  12. {trainingsample-0.2.17 → trainingsample-0.3.0}/tests/test_performance_benchmarks.py +30 -54
  13. {trainingsample-0.2.17 → trainingsample-0.3.0}/tests/test_python_bindings.py +38 -0
  14. {trainingsample-0.2.17 → trainingsample-0.3.0}/.cargo/config.toml +0 -0
  15. {trainingsample-0.2.17 → trainingsample-0.3.0}/.envrc +0 -0
  16. {trainingsample-0.2.17 → trainingsample-0.3.0}/.gitignore +0 -0
  17. {trainingsample-0.2.17 → trainingsample-0.3.0}/.pre-commit-config.yaml +0 -0
  18. {trainingsample-0.2.17 → trainingsample-0.3.0}/.rustfmt.toml +0 -0
  19. {trainingsample-0.2.17 → trainingsample-0.3.0}/BENCHMARKS.md +0 -0
  20. {trainingsample-0.2.17 → trainingsample-0.3.0}/Dockerfile +0 -0
  21. {trainingsample-0.2.17 → trainingsample-0.3.0}/LICENSE +0 -0
  22. {trainingsample-0.2.17 → trainingsample-0.3.0}/README.md +0 -0
  23. {trainingsample-0.2.17 → trainingsample-0.3.0}/clippy.toml +0 -0
  24. {trainingsample-0.2.17 → trainingsample-0.3.0}/docs/API_COMPAT_CV2.md +0 -0
  25. {trainingsample-0.2.17 → trainingsample-0.3.0}/docs/BUILDING_STATIC_OPENCV.md +0 -0
  26. {trainingsample-0.2.17 → trainingsample-0.3.0}/rust-toolchain.toml +0 -0
  27. {trainingsample-0.2.17 → trainingsample-0.3.0}/scripts/build-opencv-static.sh +0 -0
  28. {trainingsample-0.2.17 → trainingsample-0.3.0}/scripts/repair-wheel.sh +0 -0
  29. {trainingsample-0.2.17 → trainingsample-0.3.0}/scripts/run_competitive_benchmarks.sh +0 -0
  30. {trainingsample-0.2.17 → trainingsample-0.3.0}/setup-env.sh +0 -0
  31. {trainingsample-0.2.17 → trainingsample-0.3.0}/src/core.rs +0 -0
  32. {trainingsample-0.2.17 → trainingsample-0.3.0}/src/cv_batch_ops.rs +0 -0
  33. {trainingsample-0.2.17 → trainingsample-0.3.0}/src/cv_batch_ops_optimized.rs +0 -0
  34. {trainingsample-0.2.17 → trainingsample-0.3.0}/src/cv_compat.rs +0 -0
  35. {trainingsample-0.2.17 → trainingsample-0.3.0}/src/format_conversion_simd.rs +0 -0
  36. {trainingsample-0.2.17 → trainingsample-0.3.0}/src/lib.rs +0 -0
  37. {trainingsample-0.2.17 → trainingsample-0.3.0}/src/loading.rs +0 -0
  38. {trainingsample-0.2.17 → trainingsample-0.3.0}/src/luminance.rs +0 -0
  39. {trainingsample-0.2.17 → trainingsample-0.3.0}/src/luminance_simd.rs +0 -0
  40. {trainingsample-0.2.17 → trainingsample-0.3.0}/src/true_batch_ops.rs +0 -0
  41. {trainingsample-0.2.17 → trainingsample-0.3.0}/tests/__init__.py +0 -0
  42. {trainingsample-0.2.17 → trainingsample-0.3.0}/tests/test_comprehensive.py +0 -0
@@ -265,7 +265,7 @@ jobs:
265
265
  components: rustfmt, clippy
266
266
 
267
267
  - name: Install cargo-audit
268
- run: cargo install cargo-audit
268
+ run: cargo install cargo-audit --version 0.22.2 --locked
269
269
 
270
270
  - name: Install pre-commit
271
271
  run: pip install pre-commit
@@ -383,79 +383,86 @@ jobs:
383
383
  path: dist/
384
384
 
385
385
  build-wheels-aarch64:
386
- name: Build wheels (Linux aarch64)
386
+ name: Build wheels (Linux aarch64 / DGX Spark)
387
387
  runs-on: ubuntu-24.04-arm
388
388
  strategy:
389
389
  matrix:
390
- python-version: ["3.11", "3.12", "3.13"]
390
+ python: ["3.11", "3.12", "3.13"]
391
391
 
392
392
  steps:
393
393
  - uses: actions/checkout@v4
394
394
 
395
- - name: Install OpenCV and LLVM dependencies
395
+ - name: Set up Python ${{ matrix.python }}
396
+ uses: actions/setup-python@v5
397
+ with:
398
+ python-version: ${{ matrix.python }}
399
+
400
+ - name: Cache static OpenCV
401
+ uses: actions/cache@v4
402
+ with:
403
+ path: third_party/opencv-static
404
+ key: opencv-static-4.11.0-codecs-jasper-ffmpeg-no-itt-no-openjpeg-linux-aarch64-${{ runner.arch }}-manylinux_2_39
405
+
406
+ - name: Install build dependencies
396
407
  run: |
408
+ export DEBIAN_FRONTEND=noninteractive
409
+
397
410
  sudo apt-get update
398
- sudo apt-get install -y pkg-config clang libclang-dev llvm-dev wget cmake build-essential
399
- # Install LLVM 18 which has the proper libclang.so symlink
411
+ sudo apt-get install -y pkg-config clang libclang-dev llvm-dev wget cmake build-essential curl nasm yasm
412
+
400
413
  sudo apt-get install -y llvm-18 llvm-18-dev llvm-18-tools libclang1-18 libclang-cpp18
401
- # Set environment variables for LLVM 18
402
- echo "LIBCLANG_PATH=/usr/lib/llvm-18/lib" >> $GITHUB_ENV
403
414
  echo "LLVM_CONFIG_PATH=/usr/bin/llvm-config-18" >> $GITHUB_ENV
404
- echo "LD_LIBRARY_PATH=/usr/lib/llvm-18/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
405
415
 
406
- # Build OpenCV 4.11 from source
407
- echo "Building OpenCV 4.11 from source..."
408
- cd /tmp
409
- wget -q https://github.com/opencv/opencv/archive/4.11.0.tar.gz
410
- tar -xzf 4.11.0.tar.gz
411
- cd opencv-4.11.0
412
- mkdir build
413
- cd build
414
- cmake \
415
- -DCMAKE_BUILD_TYPE=RELEASE \
416
- -DCMAKE_INSTALL_PREFIX=/usr/local \
417
- -DWITH_CUDA=OFF \
418
- -DWITH_OPENGL=OFF \
419
- -DWITH_OPENCL=OFF \
420
- -DWITH_TBB=OFF \
421
- -DWITH_IPP=OFF \
422
- -DWITH_1394=OFF \
423
- -DWITH_V4L=OFF \
424
- -DWITH_GTK=OFF \
425
- -DBUILD_TESTS=OFF \
426
- -DBUILD_PERF_TESTS=OFF \
427
- -DBUILD_EXAMPLES=OFF \
428
- -DBUILD_opencv_python2=OFF \
429
- -DBUILD_opencv_python3=OFF \
430
- -DBUILD_opencv_java=OFF \
431
- -DOPENCV_GENERATE_PKGCONFIG=ON \
432
- ..
433
- make -j$(nproc)
434
- sudo make install
435
- sudo ldconfig
416
+ LIBCLANG_PATH="/usr/lib/llvm-18/lib"
417
+ if [ ! -f "$LIBCLANG_PATH/libclang.so" ]; then
418
+ LIBCLANG_PATH=$(find /usr/lib/llvm* -name "libclang.so" 2>/dev/null | head -1 | xargs dirname)
419
+ fi
436
420
 
437
- # Set OpenCV environment variables
438
- echo "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
439
- echo "LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
421
+ echo "LIBCLANG_PATH=$LIBCLANG_PATH" >> $GITHUB_ENV
422
+ echo "LD_LIBRARY_PATH=$LIBCLANG_PATH:$LD_LIBRARY_PATH" >> $GITHUB_ENV
423
+ echo "Using libclang.so at: $LIBCLANG_PATH/libclang.so"
440
424
 
441
- - name: Set up Python ${{ matrix.python-version }}
442
- uses: actions/setup-python@v4
443
- with:
444
- python-version: ${{ matrix.python-version }}
425
+ - name: Build static OpenCV
426
+ run: ./scripts/build-opencv-static.sh
445
427
 
446
- - name: Install Rust toolchain
447
- uses: dtolnay/rust-toolchain@master
428
+ - name: Build wheels
429
+ uses: PyO3/maturin-action@v1
448
430
  with:
449
- toolchain: 1.89
431
+ target: aarch64
432
+ args: --release --out dist --no-default-features --features python-bindings,simd,opencv
433
+ sccache: 'false'
434
+ container: off
435
+ manylinux: manylinux_2_39
436
+ env:
437
+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
438
+ LIBCLANG_PATH: ${{ env.LIBCLANG_PATH }}
439
+ LLVM_CONFIG_PATH: ${{ env.LLVM_CONFIG_PATH }}
440
+ OPENCV_INCLUDE_PATHS: ${{ github.workspace }}/third_party/opencv-static/include/opencv4
441
+ OPENCV_LINK_PATHS: ${{ github.workspace }}/third_party/opencv-static/lib
442
+ OPENCV_LINK_LIBS: static=opencv_world,static=avformat,static=avcodec,static=avfilter,static=swresample,static=swscale,static=avutil,static=jpeg,static=png,static=tiff,static=webp,static=z,static=jasper,dylib=stdc++
443
+ OPENCV_DISABLE_PROBES: pkg_config,cmake,vcpkg,vcpkg_cmake
450
444
 
451
- - name: Install maturin
452
- run: pip install maturin[patchelf]
445
+ - name: Repair wheels
446
+ env:
447
+ OPENCV_LINK_PATHS: ${{ github.workspace }}/third_party/opencv-static/lib
448
+ run: ./scripts/repair-wheel.sh dist/*.whl
453
449
 
454
- - name: Build wheels
455
- run: maturin build --release --out dist --no-default-features --features python-bindings,simd,opencv
450
+ - name: Prune unrepaired wheels
451
+ run: find dist -type f -name '*.linux_*.whl' -print -delete
452
+
453
+ - name: Install built wheel
454
+ run: |
455
+ wheel="$(find dist -type f -name '*.whl' | sort | head -n 1)"
456
+ if [ -z "${wheel}" ]; then
457
+ echo "No wheel files found under dist/"
458
+ find dist -maxdepth 3 -type f || true
459
+ exit 1
460
+ fi
461
+ pip install "${wheel}"
462
+ python -c 'import trainingsample'
456
463
 
457
464
  - name: Upload wheels
458
465
  uses: actions/upload-artifact@v4
459
466
  with:
460
- name: wheels-linux-aarch64-py${{ matrix.python-version }}
467
+ name: wheels-linux-aarch64-py${{ matrix.python }}
461
468
  path: dist/
@@ -372,7 +372,7 @@ jobs:
372
372
  fi
373
373
  echo "Installing wheel: ${wheel}"
374
374
  pip install "${wheel}"
375
- python -c 'import trainingsample' || echo "Import failed"
375
+ python -c 'import trainingsample'
376
376
 
377
377
  release:
378
378
  name: Release