summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/linearmodels/default.nix
blob: 8210ae5d0a5ff2cd8646ac494264eb5691205d3e (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
71
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  cython,
  formulaic,
  mypy-extensions,
  numpy,
  pandas,
  pyhdfe,
  pytestCheckHook,
  scipy,
  setuptools,
  setuptools-scm,
  statsmodels,
}:

buildPythonPackage rec {
  pname = "linearmodels";
  version = "6.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "bashtage";
    repo = "linearmodels";
    tag = "v${version}";
    hash = "sha256-oWVBsFSKnv/8AHYP5sxO6+u5+hsOw/uQlOetse5ue88=";
  };

  postPatch = ''
    substituteInPlace requirements.txt \
      --replace-fail "setuptools_scm[toml]>=8.0.0,<9.0.0" "setuptools_scm[toml]"
    substituteInPlace pyproject.toml \
      --replace-fail "setuptools_scm[toml]>=8,<9" "setuptools_scm[toml]"
  '';

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

  env.SETUPTOOLS_SCM_PRETEND_VERSION = version;

  dependencies = [
    formulaic
    mypy-extensions
    numpy
    pandas
    pyhdfe
    scipy
    statsmodels
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "linearmodels" ];

  disabledTestPaths = [
    # Skip long-running tests
    "linearmodels/tests/panel/test_panel_ols.py"
  ];

  meta = {
    description = "Models for panel data, system regression, instrumental variables and asset pricing";
    homepage = "https://bashtage.github.io/linearmodels/";
    changelog = "https://github.com/bashtage/linearmodels/releases/tag/v${version}";
    license = lib.licenses.ncsa;
    maintainers = with lib.maintainers; [ jherland ];
  };
}