1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchFromGitHub
5, fetchpatch
6
7, setuptools
8
9, cmdstanpy
10, numpy
11, matplotlib
12, pandas
13, lunarcalendar
14, convertdate
15, holidays
16, python-dateutil
17, tqdm
18, importlib-resources
19
20, pytestCheckHook
21}:
22
23buildPythonPackage rec {
24 pname = "prophet";
25 version = "1.1.4";
26 format = "pyproject";
27
28 disabled = pythonOlder "3.7";
29
30 src = fetchFromGitHub {
31 owner = "facebook";
32 repo = "prophet";
33 rev = "refs/tags/v${version}";
34 hash = "sha256-pbJ0xL5wDZ+rKgtQQTJPsB1Mu2QXo3S9MMpiYkURsz0=";
35 };
36
37 patches = [
38 # TODO: remove when bumping version from 1.1.4
39 (fetchpatch {
40 name = "fix-stan-file-temp-dest.patch";
41 url = "https://github.com/facebook/prophet/commit/374676500795aec9d5cbc7fe5f7a96bf00489809.patch";
42 hash = "sha256-sfiQ2V3ZEF0WM9oM1FkL/fhZesQJ1i2EUPYJMdDA2UM=";
43 relative = "python";
44 })
45 ];
46
47 sourceRoot = "${src.name}/python";
48
49 env.PROPHET_REPACKAGE_CMDSTAN = "false";
50
51 nativeBuildInputs = [ setuptools ];
52
53 # TODO: update when bumping version from 1.1.4
54 propagatedBuildInputs = [
55 cmdstanpy
56 numpy
57 matplotlib
58 pandas
59 lunarcalendar
60 convertdate
61 holidays
62 python-dateutil
63 tqdm
64 importlib-resources
65 ];
66
67 preCheck = ''
68 # the generated stan_model directory only exists in build/lib*
69 cd build/lib*
70 '';
71
72 nativeCheckInputs = [ pytestCheckHook ];
73
74 pythonImportsCheck = [ "prophet" ];
75
76 meta = {
77 homepage = "https://facebook.github.io/prophet/";
78 description = "A tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth";
79 changelog = "https://github.com/facebook/prophet/releases/tag/v${version}";
80 license = lib.licenses.mit;
81 platforms = lib.platforms.linux;
82 maintainers = with lib.maintainers; [ tomasajt ];
83 };
84}