Unverified Commit c1d3a123 authored by Zexin Yuan's avatar Zexin Yuan
Browse files

python3Packages.imagecodecs: init at 2025.3.30

parent 71e5dc4d
Loading
Loading
Loading
Loading
+90 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  cython,
  numpy,
  setuptools,
  pkgs,
  jxrlib,
  lcms2,
  lerc,
  libdeflate,
  libpng,
  libtiff,
  libwebp,
  openjpeg,
  xz,
  zlib,
  zstd,
  pytest,
}:

let
  version = "2025.3.30";
in
buildPythonPackage {
  pname = "imagecodecs";
  inherit version;
  pyproject = true;

  src = fetchFromGitHub {
    owner = "cgohlke";
    repo = "imagecodecs";
    tag = "v${version}";
    hash = "sha256-KtrQNABQOr3mNiWOfaZBcFceSCixPGV8Hte2uPKn1+k=";
  };

  build-system = [
    cython
    numpy
    setuptools
  ];

  nativeBuildInputs = [
    pkgs.lz4.dev # lz4 was hidden by python3Packages.lz4
    lcms2.dev
    openjpeg.dev
  ];

  buildInputs = [
    pkgs.lz4
    jxrlib
    lcms2
    lerc
    libdeflate
    libpng
    libtiff
    libwebp
    openjpeg
    xz # liblzma
    zlib
    zstd
  ];

  dependencies = [
    numpy
  ];

  prePatch = ''
    substituteInPlace setup.py \
      --replace-fail "/usr/include/openjpeg" "${openjpeg.dev}/include/openjpeg" \
      --replace-fail "/usr/include/jxrlib" "${jxrlib}/include/jxrlib"
  '';

  nativeCheckInputs = [
    pytest
  ];

  pythonImportsCheck = [
    "imagecodecs"
  ];

  meta = {
    description = "Image transformation, compression, and decompression codecs";
    homepage = "https://github.com/cgohlke/imagecodecs";
    changelog = "https://github.com/cgohlke/imagecodecs/blob/v${version}/CHANGES.rst";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ yzx9 ];
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -6572,6 +6572,8 @@ self: super: with self; {
  image-go-nord = callPackage ../development/python-modules/image-go-nord { };
  imagecodecs = callPackage ../development/python-modules/imagecodecs { };
  imagecodecs-lite = callPackage ../development/python-modules/imagecodecs-lite { };
  imagecorruptions = callPackage ../development/python-modules/imagecorruptions { };