From a75ec05cc89af64468da07c139ba738d575d5bc8 Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Wed, 9 Apr 2025 11:47:06 -0400 Subject: [PATCH 1/2] python313Packages.lightning: init at 2.5.1 --- .../python-modules/lightning/default.nix | 43 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 45 insertions(+) create mode 100644 pkgs/development/python-modules/lightning/default.nix diff --git a/pkgs/development/python-modules/lightning/default.nix b/pkgs/development/python-modules/lightning/default.nix new file mode 100644 index 000000000000..e3a096c9163b --- /dev/null +++ b/pkgs/development/python-modules/lightning/default.nix @@ -0,0 +1,43 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + + # dependencies + pytorch-lightning, + + # tests + psutil, + pytestCheckHook, +}: + +buildPythonPackage { + pname = "lightning"; + pyproject = true; + + inherit (pytorch-lightning) + version + src + build-system + meta + ; + + dependencies = pytorch-lightning.dependencies ++ [ pytorch-lightning ]; + + nativeCheckInputs = [ + psutil + pytestCheckHook + ]; + + # Some packages are not in NixPkgs; other tests try to build distributed + # models, which doesn't work in the sandbox. + doCheck = false; + + pythonImportsCheck = [ + "lightning" + "lightning.pytorch" + ]; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 7f725c55c9c1..57d880a4b71b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7869,6 +7869,8 @@ self: super: with self; { lightify = callPackage ../development/python-modules/lightify { }; + lightning = callPackage ../development/python-modules/lightning { }; + lightning-utilities = callPackage ../development/python-modules/lightning-utilities { }; lightparam = callPackage ../development/python-modules/lightparam { }; From dabd1a06c16e75636f439d37f954934f15dbcc8e Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Wed, 9 Apr 2025 11:37:29 -0400 Subject: [PATCH 2/2] python313Packages.gluonts: init at 0.16.1 --- .../python-modules/gluonts/default.nix | 113 ++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 115 insertions(+) create mode 100644 pkgs/development/python-modules/gluonts/default.nix diff --git a/pkgs/development/python-modules/gluonts/default.nix b/pkgs/development/python-modules/gluonts/default.nix new file mode 100644 index 000000000000..4e3c2b79565f --- /dev/null +++ b/pkgs/development/python-modules/gluonts/default.nix @@ -0,0 +1,113 @@ +{ + stdenv, + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + + # dependencies + numpy, + pandas, + pydantic, + tqdm, + toolz, + + # optional dependencies (torch) + torch, + lightning, + scipy, + + # test + pytestCheckHook, + distutils, + matplotlib, + pyarrow, + statsmodels, + which, +}: + +buildPythonPackage rec { + pname = "gluonts"; + version = "0.16.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "awslabs"; + repo = "gluonts"; + tag = "v${version}"; + hash = "sha256-i4yCNe8C9BZw6AZUDOZC1E9PQOOOoUovSZnOF1yzycM="; + }; + + build-system = [ + setuptools + ]; + + dependencies = [ + numpy + pandas + pydantic + tqdm + toolz + ]; + + optional-dependencies = { + torch = [ + torch + lightning + scipy + ]; + }; + + pythonRelaxDeps = [ + "numpy" + "toolz" + ]; + + pythonImportsCheck = [ + "gluonts" + "gluonts.core" + "gluonts.dataset" + "gluonts.ev" + "gluonts.evaluation" + "gluonts.ext" + "gluonts.model" + "gluonts.shell" + "gluonts.time_feature" + "gluonts.torch" + "gluonts.transform" + ]; + + nativeCheckInputs = [ + pytestCheckHook + distutils + matplotlib + pyarrow + statsmodels + which + ] ++ optional-dependencies.torch; + + preCheck = ''export HOME=$(mktemp -d)''; + + disabledTestPaths = [ + # requires `cpflows`, not in Nixpkgs + "test/torch/model" + ]; + + disabledTests = + [ + # tries to access network + "test_against_former_evaluator" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # RuntimeError: *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1] + "test_forecast" + ]; + + meta = { + description = "Probabilistic time series modeling in Python"; + homepage = "https://ts.gluon.ai"; + changelog = "https://github.com/awslabs/gluonts/releases/tag/${src.tag}"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ bcdarwin ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 57d880a4b71b..eeafcd5ca496 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5584,6 +5584,8 @@ self: super: with self; { glueviz = callPackage ../development/python-modules/glueviz { }; + gluonts = callPackage ../development/python-modules/gluonts { }; + glymur = callPackage ../development/python-modules/glymur { }; glyphsets = callPackage ../development/python-modules/glyphsets { };