1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchFromGitHub,
6 setuptools,
7
8 # dependencies
9 numpy,
10 pandas,
11 pydantic,
12 tqdm,
13 toolz,
14
15 # optional dependencies (torch)
16 torch,
17 lightning,
18 scipy,
19
20 # test
21 pytestCheckHook,
22 distutils,
23 matplotlib,
24 pyarrow,
25 statsmodels,
26 which,
27}:
28
29buildPythonPackage rec {
30 pname = "gluonts";
31 version = "0.16.2";
32 pyproject = true;
33
34 src = fetchFromGitHub {
35 owner = "awslabs";
36 repo = "gluonts";
37 tag = "v${version}";
38 hash = "sha256-h0+RYgGMz0gPchiKGIu0/NGcWBky5AWNTJKzoupn/iQ=";
39 };
40
41 build-system = [
42 setuptools
43 ];
44
45 dependencies = [
46 numpy
47 pandas
48 pydantic
49 tqdm
50 toolz
51 ];
52
53 optional-dependencies = {
54 torch = [
55 torch
56 lightning
57 scipy
58 ];
59 };
60
61 pythonRelaxDeps = [
62 "numpy"
63 "toolz"
64 ];
65
66 pythonImportsCheck = [
67 "gluonts"
68 "gluonts.core"
69 "gluonts.dataset"
70 "gluonts.ev"
71 "gluonts.evaluation"
72 "gluonts.ext"
73 "gluonts.model"
74 "gluonts.shell"
75 "gluonts.time_feature"
76 "gluonts.torch"
77 "gluonts.transform"
78 ];
79
80 nativeCheckInputs = [
81 pytestCheckHook
82 distutils
83 matplotlib
84 pyarrow
85 statsmodels
86 which
87 ]
88 ++ optional-dependencies.torch;
89
90 preCheck = ''export HOME=$(mktemp -d)'';
91
92 disabledTestPaths = [
93 # requires `cpflows`, not in Nixpkgs
94 "test/torch/model"
95 ];
96
97 disabledTests = [
98 # tries to access network
99 "test_against_former_evaluator"
100 ]
101 ++ lib.optionals stdenv.hostPlatform.isDarwin [
102 # RuntimeError: *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]
103 "test_forecast"
104 ];
105
106 meta = {
107 description = "Probabilistic time series modeling in Python";
108 homepage = "https://ts.gluon.ai";
109 changelog = "https://github.com/awslabs/gluonts/releases/tag/${src.tag}";
110 license = lib.licenses.asl20;
111 maintainers = with lib.maintainers; [ bcdarwin ];
112 };
113}