1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 numpy,
7 scipy,
8 pandas,
9 matplotlib,
10 pytestCheckHook,
11 pythonOlder,
12}:
13
14buildPythonPackage rec {
15 pname = "seasonal";
16 version = "0.3.1";
17 pyproject = true;
18
19 disabled = pythonOlder "3.6";
20
21 src = fetchFromGitHub {
22 owner = "welch";
23 repo = "seasonal";
24 # There are no tags or releases, but this commit corresponds to the 0.3.1 version
25 # PyPI project contains only a wheel
26 rev = "2a2396014d46283d0c7aff34cde5dafb6c462c58";
27 hash = "sha256-8YedGylH70pI0OyefiS1PG1yc+sg+tchlgcuNvxcNqE=";
28 };
29
30 postPatch = ''
31 substituteInPlace setup.py \
32 --replace 'setup_requires=["pytest-runner"],' ""
33 '';
34
35 nativeBuildInputs = [ setuptools ];
36
37 propagatedBuildInputs = [
38 numpy
39 scipy
40 ];
41
42 optional-dependencies = {
43 csv = [ pandas ];
44 plot = [ matplotlib ];
45 };
46
47 pythonImportsCheck = [
48 "seasonal"
49 "seasonal.trend"
50 "seasonal.periodogram"
51 ];
52 nativeCheckInputs = [
53 pytestCheckHook
54 ]
55 ++ lib.flatten (builtins.attrValues optional-dependencies);
56
57 meta = with lib; {
58 description = "Robustly estimate trend and periodicity in a timeseries";
59 homepage = "https://github.com/welch/seasonal";
60 license = licenses.mit;
61 maintainers = with maintainers; [ mbalatsko ];
62 };
63}