From 4347f5d54b9bc16dffbfd79218ed3b0ec77ec9a7 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Tue, 9 Jun 2026 17:47:34 +0000 Subject: [PATCH] python3Packages.pyg-lib: init at 0.7.0 --- .../python-modules/pyg-lib/default.nix | 86 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 88 insertions(+) create mode 100644 pkgs/development/python-modules/pyg-lib/default.nix diff --git a/pkgs/development/python-modules/pyg-lib/default.nix b/pkgs/development/python-modules/pyg-lib/default.nix new file mode 100644 index 000000000000..524e27fdb4a7 --- /dev/null +++ b/pkgs/development/python-modules/pyg-lib/default.nix @@ -0,0 +1,86 @@ +{ + lib, + stdenv, + buildPythonPackage, + fetchFromGitHub, + + # build-system + cmake, + ninja, + setuptools, + torch, + + # tests + pytestCheckHook, +}: +let + inherit (torch) cudaPackages cudaSupport cudaCapabilities; +in +buildPythonPackage.override { inherit (torch) stdenv; } (finalAttrs: { + pname = "pyg-lib"; + version = "0.7.0"; + pyproject = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "pyg-team"; + repo = "pyg-lib"; + tag = finalAttrs.version; + fetchSubmodules = true; + hash = "sha256-czHSOIocmoup502kLS8v+aeu6fVPPhqFh3hbGcFvNEQ="; + }; + + build-system = [ + cmake + ninja + setuptools + torch + ]; + dontUseCmakeConfigure = true; + + nativeBuildInputs = lib.optionals cudaSupport [ + cudaPackages.cuda_nvcc + ]; + + env = lib.optionalAttrs cudaSupport { + TORCH_CUDA_ARCH_LIST = "${lib.concatStringsSep ";" cudaCapabilities}"; + }; + + buildInputs = [ + torch.cxxdev + torch + ]; + + pythonImportsCheck = [ "pyg_lib" ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + preCheck = '' + rm -rf pyg_lib + ''; + + disabledTests = + lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [ + # aarch64-linux fails cpuinfo test, because /sys/devices/system/cpu/ does not exist in the sandbox: + # RuntimeError: Failed to initialize cpuinfo! + "test_scatter_mean_forward_dtypes" + "test_scatter_sum_forward_dtypes" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # Trace/BPT trap: 5 + "test_hetero_neighbor_sampler_temporal_sample" + ]; + + meta = { + description = "Low-Level Graph Neural Network Operators for PyG"; + homepage = "https://github.com/pyg-team/pyg-lib"; + changelog = "https://github.com/pyg-team/pyg-lib/blob/${finalAttrs.src.tag}/CHANGELOG.md"; + license = with lib.licenses; [ + mit + bsd3 + ]; + maintainers = with lib.maintainers; [ GaetanLepage ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 0af660bc2b5e..e1ebe120cacc 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -14118,6 +14118,8 @@ self: super: with self; { pyfzf = callPackage ../development/python-modules/pyfzf { inherit (pkgs) fzf; }; + pyg-lib = callPackage ../development/python-modules/pyg-lib { }; + pygal = callPackage ../development/python-modules/pygal { }; # pygame-ce is better maintained upstream, the breaking point was https://github.com/NixOS/nixpkgs/pull/475917#issuecomment-3706940043