summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pytorch-tabnet/default.nix
blob: 90b61e4aa89713e75ff067b3e90a8feafe2b5efa (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fsspec,
  numpy,
  poetry-core,
  pytestCheckHook,
  scikit-learn,
  scipy,
  torch,
  tqdm,
  typing-extensions,
}:

buildPythonPackage rec {
  pname = "pytorch-tabnet";
  version = "4.1.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "dreamquark-ai";
    repo = "tabnet";
    tag = "v${version}";
    hash = "sha256-WyNGgAkNn5CaEuHWQ6Fjnvnrp+KONnxUQudd5ckvcsM=";
  };

  # Modernize poetry build setup
  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail 'requires = ["poetry>=0.12"]' 'requires = ["poetry-core"]' \
      --replace-fail 'build-backend = "poetry.masonry.api"' 'build-backend = "poetry.core.masonry.api"'
  '';

  build-system = [ poetry-core ];

  dependencies = [
    numpy
    scikit-learn
    scipy
    torch
    tqdm
    typing-extensions
  ];

  nativeCheckInputs = [
    pytestCheckHook
    fsspec
  ];

  pythonImportsCheck = [ "pytorch_tabnet" ];

  meta = {
    description = "PyTorch implementation of TabNet";
    homepage = "https://github.com/dreamquark-ai/tabnet";
    changelog = "https://github.com/dreamquark-ai/tabnet/releases/tag/v${version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ jherland ];
  };
}