1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 cython,
6 joblib,
7 matplotlib,
8 numpy,
9 pandas,
10 scikit-learn,
11 scipy,
12 statsmodels,
13 urllib3,
14 pythonOlder,
15 python,
16 pytest7CheckHook,
17 setuptools,
18}:
19
20buildPythonPackage rec {
21 pname = "pmdarima";
22 version = "2.0.4";
23 pyproject = true;
24
25 disabled = pythonOlder "3.7";
26
27 src = fetchFromGitHub {
28 owner = "alkaline-ml";
29 repo = "pmdarima";
30 tag = "v${version}";
31 hash = "sha256-LHwPgQRB/vP3hBM8nqafoCrN3ZSRIMWLzqTqDOETOEc=";
32 };
33
34 postPatch = ''
35 substituteInPlace pyproject.toml \
36 --replace-fail "numpy==" "numpy>=" \
37 --replace-fail "scipy==" "scipy>=" \
38 --replace-fail "statsmodels==" "statsmodels>="
39 '';
40
41 env = {
42 GITHUB_REF = "refs/tags/v${version}";
43 };
44
45 preBuild = ''
46 python build_tools/get_tag.py
47 '';
48
49 nativeBuildInputs = [ cython ];
50
51 build-system = [
52 setuptools
53 ];
54
55 dependencies = [
56 joblib
57 numpy
58 pandas
59 scikit-learn
60 scipy
61 statsmodels
62 urllib3
63 ];
64
65 # Make sure we're running the tests for the actually installed
66 # package, so that cython's compiled files are available.
67 preCheck = ''
68 cd $out/${python.sitePackages}
69 '';
70
71 nativeCheckInputs = [
72 matplotlib
73 pytest7CheckHook
74 ];
75
76 disabledTests = [
77 # touches internet
78 "test_load_from_web"
79 ];
80
81 pythonImportsCheck = [ "pmdarima" ];
82
83 meta = {
84 description = "Statistical library designed to fill the void in Python's time series analysis capabilities, including the equivalent of R's auto.arima function";
85 homepage = "https://github.com/alkaline-ml/pmdarima";
86 changelog = "https://github.com/alkaline-ml/pmdarima/releases/tag/v${version}";
87 license = lib.licenses.mit;
88 maintainers = with lib.maintainers; [ mbalatsko ];
89 };
90}