summaryrefslogtreecommitdiffstats
path: root/pkgs/development/python-modules/arch/default.nix
blob: 6614d78c7f67079f014ce14b6284844713a9ca86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
  lib,
  buildPythonPackage,
  python,
  fetchFromGitHub,
  cython,
  numpy,
  pandas,
  property-cached,
  pytestCheckHook,
  scipy,
  setuptools-scm,
  statsmodels,
  meson-python,
}:

buildPythonPackage rec {
  pname = "arch";
  version = "8.0.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "bashtage";
    repo = "arch";
    tag = "v${version}";
    hash = "sha256-qw8sSgsMu6YTiQlzsrePnDKkFBtrxD9RK6ZZE5jFeX0=";
  };

  build-system = [
    setuptools-scm
    cython
    meson-python
  ];

  dependencies = [
    numpy
    pandas
    property-cached
    scipy
    statsmodels
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  # Replace the source tree's arch/ with symlinks to the installed package.
  # pytest adds rootdir to sys.path, so the source arch/ always shadows the
  # installed one. The source tree lacks _version.py (generated by setuptools-scm)
  # and compiled Cython extensions, causing import failures.
  # Symlinking to the installed package makes all imports resolve correctly.
  preCheck = ''
    rm -rf arch
    ln -s $out/${python.sitePackages}/arch arch
  '';

  disabledTestPaths = [
    # Skip long-running/failing tests
    "arch/tests/univariate/test_forecast.py"
    "arch/tests/univariate/test_mean.py"
  ];

  pythonImportsCheck = [ "arch" ];

  meta = {
    description = "Autoregressive Conditional Heteroskedasticity (ARCH) and other tools for financial econometrics";
    homepage = "https://github.com/bashtage/arch";
    changelog = "https://github.com/bashtage/arch/releases/tag/${src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ jherland ];
  };
}