1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 cython,
6 formulaic,
7 mypy-extensions,
8 numpy,
9 pandas,
10 pyhdfe,
11 pytestCheckHook,
12 scipy,
13 setuptools,
14 setuptools-scm,
15 statsmodels,
16}:
17
18buildPythonPackage rec {
19 pname = "linearmodels";
20 version = "6.1";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "bashtage";
25 repo = "linearmodels";
26 tag = "v${version}";
27 hash = "sha256-oWVBsFSKnv/8AHYP5sxO6+u5+hsOw/uQlOetse5ue88=";
28 };
29
30 postPatch = ''
31 substituteInPlace requirements.txt \
32 --replace-fail "setuptools_scm[toml]>=8.0.0,<9.0.0" "setuptools_scm[toml]"
33 substituteInPlace pyproject.toml \
34 --replace-fail "setuptools_scm[toml]>=8,<9" "setuptools_scm[toml]"
35 '';
36
37 build-system = [
38 setuptools
39 setuptools-scm
40 cython
41 ];
42
43 env.SETUPTOOLS_SCM_PRETEND_VERSION = version;
44
45 dependencies = [
46 formulaic
47 mypy-extensions
48 numpy
49 pandas
50 pyhdfe
51 scipy
52 statsmodels
53 ];
54
55 nativeCheckInputs = [ pytestCheckHook ];
56
57 pythonImportsCheck = [ "linearmodels" ];
58
59 disabledTestPaths = [
60 # Skip long-running tests
61 "linearmodels/tests/panel/test_panel_ols.py"
62 ];
63
64 meta = {
65 description = "Models for panel data, system regression, instrumental variables and asset pricing";
66 homepage = "https://bashtage.github.io/linearmodels/";
67 changelog = "https://github.com/bashtage/linearmodels/releases/tag/v${version}";
68 license = lib.licenses.ncsa;
69 maintainers = with lib.maintainers; [ jherland ];
70 };
71}