nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at r-updates 134 lines 2.7 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 fetchpatch, 7 pythonAtLeast, 8 9 # build-system 10 setuptools, 11 12 # dependencies 13 numpy, 14 pandas, 15 pydantic, 16 tqdm, 17 toolz, 18 19 # optional dependencies (torch) 20 torch, 21 lightning, 22 scipy, 23 24 # tests 25 pytestCheckHook, 26 distutils, 27 matplotlib, 28 pyarrow, 29 statsmodels, 30 writableTmpDirAsHomeHook, 31 which, 32}: 33 34buildPythonPackage (finalAttrs: { 35 pname = "gluonts"; 36 version = "0.16.2"; 37 pyproject = true; 38 39 src = fetchFromGitHub { 40 owner = "awslabs"; 41 repo = "gluonts"; 42 tag = "v${finalAttrs.version}"; 43 hash = "sha256-h0+RYgGMz0gPchiKGIu0/NGcWBky5AWNTJKzoupn/iQ="; 44 }; 45 46 # pydantic.v1.errors.ConfigError: unable to infer type for attribute "target" 47 disabled = pythonAtLeast "3.14"; 48 49 patches = [ 50 # Fixes _pickle.UnpicklingError: Weights only load failed. 51 # https://github.com/awslabs/gluonts/pull/3269 52 (fetchpatch { 53 name = "fix-torch-load_from_checkpoint"; 54 url = "https://github.com/awslabs/gluonts/pull/3269/commits/6420e75cfbeabcd94e2ff09dfed3b2eeb4881710.patch"; 55 hash = "sha256-UeLjgKra+Y3uPoTBle+YCxD0a1ahu6d5anrMHn4HH2I="; 56 }) 57 ]; 58 59 build-system = [ 60 setuptools 61 ]; 62 63 dependencies = [ 64 numpy 65 pandas 66 pydantic 67 tqdm 68 toolz 69 ]; 70 71 optional-dependencies = { 72 torch = [ 73 torch 74 lightning 75 scipy 76 ]; 77 }; 78 79 pythonRelaxDeps = [ 80 "numpy" 81 "toolz" 82 ]; 83 84 pythonImportsCheck = [ 85 "gluonts" 86 "gluonts.core" 87 "gluonts.dataset" 88 "gluonts.ev" 89 "gluonts.evaluation" 90 "gluonts.ext" 91 "gluonts.model" 92 "gluonts.shell" 93 "gluonts.time_feature" 94 "gluonts.torch" 95 "gluonts.transform" 96 ]; 97 98 nativeCheckInputs = [ 99 pytestCheckHook 100 distutils 101 matplotlib 102 pyarrow 103 statsmodels 104 writableTmpDirAsHomeHook 105 which 106 ] 107 ++ finalAttrs.passthru.optional-dependencies.torch; 108 109 disabledTestPaths = [ 110 # requires `cpflows`, not in Nixpkgs 111 "test/torch/model" 112 ] 113 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 114 # Trace/BPT trap: 5 115 "test/torch/test_torch_item_id_info.py" 116 ]; 117 118 disabledTests = [ 119 # tries to access network 120 "test_against_former_evaluator" 121 ] 122 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 123 # RuntimeError: *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1] 124 "test_forecast" 125 ]; 126 127 meta = { 128 description = "Probabilistic time series modeling in Python"; 129 homepage = "https://ts.gluon.ai"; 130 changelog = "https://github.com/awslabs/gluonts/releases/tag/${finalAttrs.src.tag}"; 131 license = lib.licenses.asl20; 132 maintainers = with lib.maintainers; [ bcdarwin ]; 133 }; 134})