diff --git a/pkgs/development/python-modules/albucore/default.nix b/pkgs/development/python-modules/albucore/default.nix index 8000174085d1..7158b48c67a6 100644 --- a/pkgs/development/python-modules/albucore/default.nix +++ b/pkgs/development/python-modules/albucore/default.nix @@ -2,57 +2,63 @@ lib, buildPythonPackage, fetchFromGitHub, - setuptools, - pytestCheckHook, + + # build-system + hatchling, + + # dependencies + numkong, numpy, opencv-python, - simsimd, stringzilla, + + # tests + hypothesis, + pytestCheckHook, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "albucore"; - version = "0.0.24"; + version = "0.2.4"; pyproject = true; + __structuredAttrs = true; src = fetchFromGitHub { owner = "albumentations-team"; repo = "albucore"; - tag = version; - hash = "sha256-frVMPW3au/6vPRY89GIt7chCPkUMl13DpPqCPqIjz/o="; + tag = finalAttrs.version; + hash = "sha256-gI6q9ODkc2JoDfV8RA2NzwbC9A6QyZFa7C24prqMydU="; }; - postPatch = '' - substituteInPlace setup.py \ - --replace-fail \ - 'from pkg_resources import DistributionNotFound, get_distribution' \ - 'from importlib.metadata import PackageNotFoundError as DistributionNotFound, distribution as get_distribution' - ''; - - pythonRelaxDeps = [ "opencv-python" ]; - - build-system = [ setuptools ]; + build-system = [ + hatchling + ]; dependencies = [ + numkong numpy opencv-python - simsimd stringzilla ]; pythonImportsCheck = [ "albucore" ]; - nativeCheckInputs = [ pytestCheckHook ]; + nativeCheckInputs = [ + hypothesis + pytestCheckHook + ]; - # albumentations doesn't support newer versions of albucore - # and has been archived upstream in favor of relicensed `albumentationsx` - passthru.skipBulkUpdate = true; + disabledTests = [ + # Flaky on some CPUs: + # AssertionError: Not equal to tolerance rtol=1e-05, atol=1e-05 + "test_normalize_consistency_across_shapes" + ]; meta = { description = "High-performance image processing library to optimize and extend Albumentations with specialized functions for image transformations"; homepage = "https://github.com/albumentations-team/albucore"; - changelog = "https://github.com/albumentations-team/albucore/releases/tag/${version}"; + changelog = "https://github.com/albumentations-team/albucore/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ bcdarwin ]; }; -} +}) diff --git a/pkgs/development/python-modules/albumentations/default.nix b/pkgs/development/python-modules/albumentations/default.nix deleted file mode 100644 index 623187c8e1ec..000000000000 --- a/pkgs/development/python-modules/albumentations/default.nix +++ /dev/null @@ -1,103 +0,0 @@ -{ - 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 ]; - }; -} diff --git a/pkgs/development/python-modules/albumentations/dont-check-for-updates.patch b/pkgs/development/python-modules/albumentations/dont-check-for-updates.patch deleted file mode 100644 index 6f9214e02f70..000000000000 --- a/pkgs/development/python-modules/albumentations/dont-check-for-updates.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/albumentations/__init__.py b/albumentations/__init__.py -index 44ee9b9..ea3bc50 100644 ---- a/albumentations/__init__.py -+++ b/albumentations/__init__.py -@@ -22,7 +22,3 @@ from .core.transforms_interface import * - - with suppress(ImportError): - from .pytorch import * -- --# Perform the version check after all other initializations --if os.getenv("NO_ALBUMENTATIONS_UPDATE", "").lower() not in {"true", "1"}: -- check_for_updates() 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/development/python-modules/insightface/default.nix b/pkgs/development/python-modules/insightface/default.nix index 45c384fa1b91..95fdb9f918b4 100644 --- a/pkgs/development/python-modules/insightface/default.nix +++ b/pkgs/development/python-modules/insightface/default.nix @@ -1,36 +1,47 @@ { lib, - albumentations, buildPythonPackage, - cython, fetchPypi, - insightface, - matplotlib, + + # build-system + cython, + setuptools, + + # dependencies mxnet, numpy, onnx, onnxruntime, opencv-python, + requests, + scikit-image, + scipy, + tqdm, + + # optional-dependencies + # gui: pillow, pyside6, reportlab, - requests, - setuptools, - scipy, - scikit-image, scikit-learn, + # face3d + albumentationsx, + matplotlib, + + insightface, testers, - tqdm, stdenv, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "insightface"; version = "1.0.1"; pyproject = true; + __structuredAttrs = true; + # No tags on GitHub src = fetchPypi { - inherit pname version; + inherit (finalAttrs) pname version; hash = "sha256-J68kiRu7pHDLNXOzZqD8yomJ/IUDyfjygejLpv1xYHU="; }; @@ -59,16 +70,21 @@ buildPythonPackage rec { scikit-learn ]; face3d = [ - albumentations + albumentationsx matplotlib ]; }; - # aarch64-linux tries to get cpu information from /sys, which isn't available - # inside the nix build sandbox. - dontUsePythonImportsCheck = stdenv.buildPlatform.system == "aarch64-linux"; + pythonImportsCheck = [ + "insightface" + "insightface.app" + "insightface.data" + ]; - passthru.tests = lib.optionalAttrs (stdenv.buildPlatform.system != "aarch64-linux") { + # No tests in the Pypi archive + doCheck = false; + + passthru.tests = { version = testers.testVersion { package = insightface; command = "insightface-cli --help"; @@ -78,14 +94,6 @@ buildPythonPackage rec { }; }; - pythonImportsCheck = [ - "insightface" - "insightface.app" - "insightface.data" - ]; - - doCheck = false; # Upstream has no tests - meta = { description = "State-of-the-art 2D and 3D Face Analysis Project"; mainProgram = "insightface-cli"; @@ -93,4 +101,4 @@ buildPythonPackage rec { license = lib.licenses.mit; maintainers = with lib.maintainers; [ oddlama ]; }; -} +}) diff --git a/pkgs/development/rocm-modules/release-attrPaths.json b/pkgs/development/rocm-modules/release-attrPaths.json index f86ebf24603d..4b0111764e46 100644 --- a/pkgs/development/rocm-modules/release-attrPaths.json +++ b/pkgs/development/rocm-modules/release-attrPaths.json @@ -187,7 +187,6 @@ "python3Packages.accelerate", "python3Packages.adios2", "python3Packages.aigpy", - "python3Packages.albumentations", "python3Packages.ale-py", "python3Packages.anndata", "python3Packages.apptools", diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index c82063aba1d8..0f137fc7e207 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -83,6 +83,7 @@ mapAliases { aiosenz = throw "aiosenz was removed because Home Assistant switched to pysenz"; # added 2025-12-29 aioshutil = throw "'aioshutil' was removed because uiprotect no longer depends on it"; # added 2026-02-16 aioxmpp = throw "'aioxmpp' was removed because it depends on aiosasl, which is abandoned and does not work on modern Python versions."; # Added 2026-06-28 + albumentations = throw "'albumentations' was removed because it is unmaintained since 2025. You may now use albumentationsx"; # added 2026-07-18 amazon-kclpy = throw "amazon-kclpy has been removed because it has been marked as broken since at least November 2024."; # Added 2025-10-03 amazon_kclpy = throw "'amazon_kclpy' has been renamed to/replaced by 'amazon-kclpy'"; # Converted to throw 2025-10-29 amqplib = throw "amqplib has been removed as it was unmaintained upstream"; # Added 2025-11-22 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 1bb7709eab24..41ff1aede139 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -658,7 +658,7 @@ self: super: with self; { albucore = callPackage ../development/python-modules/albucore { }; - albumentations = callPackage ../development/python-modules/albumentations { }; + albumentationsx = callPackage ../development/python-modules/albumentationsx { }; ale-py = callPackage ../development/python-modules/ale-py { };