diff --git a/pkgs/development/python-modules/albumentationsx/default.nix b/pkgs/development/python-modules/albumentationsx/default.nix new file mode 100644 index 000000000000..2689048ec00d --- /dev/null +++ b/pkgs/development/python-modules/albumentationsx/default.nix @@ -0,0 +1,133 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + hatchling, + + # dependencies + albucore, + numpy, + pydantic, + pyyaml, + scipy, + typing-extensions, + + # optional-dependencies + opencv-contrib-python, + opencv-python, + opencv-python-headless, + huggingface-hub, + pillow, + torch, + pyvips, + + # tests + deepdiff, + defusedxml, + gitMinimal, + hypothesis, + pytest-mock, + pytestCheckHook, + scikit-image, + scikit-learn, + torchvision, +}: + +buildPythonPackage (finalAttrs: { + pname = "albumentationsx"; + version = "2.3.3"; + pyproject = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "albumentations-team"; + repo = "AlbumentationsX"; + tag = finalAttrs.version; + hash = "sha256-exCQwduQM29K5Omb48KYIqm2D4yfOKFFEr37zhIvACY="; + }; + + build-system = [ + hatchling + ]; + + dependencies = [ + albucore + numpy + pydantic + pyyaml + scipy + typing-extensions + ]; + + optional-dependencies = { + contrib = [ + opencv-contrib-python + ]; + contrib-headless = [ + # opencv-contrib-python-headless + ]; + gui = [ + opencv-python + ]; + headless = [ + opencv-python-headless + ]; + hub = [ + huggingface-hub + ]; + pillow = [ + pillow + ]; + pytorch = [ + torch + ]; + pyvips = [ + pyvips + ]; + text = [ + pillow + ]; + }; + + pythonImportsCheck = [ "albumentations" ]; + + nativeCheckInputs = [ + deepdiff + defusedxml + gitMinimal + hypothesis + pillow + pytest-mock + pytestCheckHook + scikit-image + scikit-learn + torch + torchvision + ]; + + disabledTests = [ + # ImportError: cannot import name 'benchmark_coverage' from 'tools' + "test_direct_script_ignores_unrelated_tools_package" + + # AssertionError: Arrays are not almost equal to 6 decimals + "test_pca_inverse_transform" + ]; + + disabledTestPaths = [ + # Infinite recursion with albu-spec + "tests/test_type_consistency.py" + + # Requires unfree google-docstring-parser + "tests/test_docstrings.py" + ]; + + meta = { + description = "Python library for image augmentation"; + homepage = "https://github.com/albumentations-team/AlbumentationsX"; + changelog = "https://github.com/albumentations-team/AlbumentationsX/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.agpl3Only; + maintainers = with lib.maintainers; [ GaetanLepage ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 28e742f91960..1fee478d8931 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -658,6 +658,8 @@ self: super: with self; { albucore = callPackage ../development/python-modules/albucore { }; + albumentationsx = callPackage ../development/python-modules/albumentationsx { }; + ale-py = callPackage ../development/python-modules/ale-py { }; alectryon = callPackage ../development/python-modules/alectryon { };