summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/formulaic/default.nix
blob: dcf48403d725a286b7a4e6978916c77277e47fc6 (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,
  fetchFromGitHub,
  hatch-vcs,
  hatchling,
  interface-meta,
  narwhals,
  numpy,
  pandas,
  scipy,
  typing-extensions,
  wrapt,
  pyarrow,
  polars,
  sympy,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "formulaic";
  version = "1.2.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "matthewwardrop";
    repo = "formulaic";
    tag = "v${version}";
    hash = "sha256-mZt+cwk/AaUmmeCj7aLu1QEBqlPUVUqQbYdgETMj/vY=";
  };

  env.SETUPTOOLS_SCM_PRETEND_VERSION = version;

  build-system = [
    hatchling
    hatch-vcs
  ];

  dependencies = [
    narwhals
    numpy
    pandas
    scipy
    wrapt
    typing-extensions
    interface-meta
  ];

  optional-dependencies = {
    arrow = [ pyarrow ];
    polars = [ polars ];
    calculus = [ sympy ];
  };

  nativeCheckInputs = [
    pytestCheckHook
  ]
  ++ optional-dependencies.arrow
  ++ optional-dependencies.calculus;

  pythonImportsCheck = [ "formulaic" ];

  meta = {
    description = "High-performance implementation of Wilkinson formulas";
    homepage = "https://matthewwardrop.github.io/formulaic/";
    changelog = "https://github.com/matthewwardrop/formulaic/releases/tag/${src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ swflint ];
  };
}