mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-21 16:11:22 +00:00
- pkg_resources is removed in setuptools 82 ([src][1])
- test_blur was failing with “ValueError: The truth value of an array
with more than one element is ambiguous”; converting sigma to float
(from `numpy.float64`) resolves, see also [this issue][2]
[1]: https://github.com/pypa/setuptools/blob/v82.0.0/NEWS.rst
[2]: https://github.com/python-pillow/Pillow/issues/8911
(cherry picked from commit e6b482cc0b)
104 lines
2.1 KiB
Nix
104 lines
2.1 KiB
Nix
{
|
|
lib,
|
|
buildPythonPackage,
|
|
fetchFromGitHub,
|
|
|
|
# build-system
|
|
setuptools,
|
|
|
|
# dependencies
|
|
albucore,
|
|
numpy,
|
|
opencv-python,
|
|
pydantic,
|
|
pyyaml,
|
|
scipy,
|
|
|
|
# optional dependencies
|
|
huggingface-hub,
|
|
pillow,
|
|
torch,
|
|
|
|
# tests
|
|
deepdiff,
|
|
pytestCheckHook,
|
|
pytest-mock,
|
|
scikit-image,
|
|
scikit-learn,
|
|
torchvision,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "albumentations";
|
|
version = "2.0.8";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "albumentations-team";
|
|
repo = "albumentations";
|
|
tag = version;
|
|
hash = "sha256-8vUipdkIelRtKwMw63oUBDN/GUI0gegMGQaqDyXAOTQ=";
|
|
};
|
|
|
|
patches = [
|
|
./dont-check-for-updates.patch
|
|
];
|
|
|
|
postPatch = ''
|
|
substituteInPlace setup.py \
|
|
--replace-fail \
|
|
'from pkg_resources import DistributionNotFound, get_distribution' \
|
|
'from importlib.metadata import PackageNotFoundError as DistributionNotFound, distribution as get_distribution'
|
|
substituteInPlace tests/test_blur.py \
|
|
--replace-fail \
|
|
'(ImageFilter.GaussianBlur(radius=sigma))' \
|
|
'(ImageFilter.GaussianBlur(radius=float(sigma)))'
|
|
'';
|
|
|
|
pythonRelaxDeps = [ "opencv-python" ];
|
|
|
|
build-system = [ setuptools ];
|
|
|
|
dependencies = [
|
|
albucore
|
|
numpy
|
|
opencv-python
|
|
pydantic
|
|
pyyaml
|
|
scipy
|
|
];
|
|
|
|
optional-dependencies = {
|
|
hub = [ huggingface-hub ];
|
|
pytorch = [ torch ];
|
|
text = [ pillow ];
|
|
};
|
|
|
|
nativeCheckInputs = [
|
|
deepdiff
|
|
pytestCheckHook
|
|
pytest-mock
|
|
scikit-image
|
|
scikit-learn
|
|
torch
|
|
torchvision
|
|
];
|
|
|
|
disabledTests = [
|
|
"test_pca_inverse_transform"
|
|
# these tests hang
|
|
"test_keypoint_remap_methods"
|
|
"test_multiprocessing_support"
|
|
];
|
|
|
|
pythonImportsCheck = [ "albumentations" ];
|
|
|
|
meta = {
|
|
description = "Fast image augmentation library and easy to use wrapper around other libraries";
|
|
homepage = "https://github.com/albumentations-team/albumentations";
|
|
changelog = "https://github.com/albumentations-team/albumentations/releases/tag/${src.tag}";
|
|
license = lib.licenses.mit;
|
|
maintainers = with lib.maintainers; [ natsukium ];
|
|
};
|
|
}
|