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