about summary refs log tree commit diff
path: root/pkgs/development/python-modules/type-infer/default.nix
blob: 93fcfe9b18d7f96628ab61ea07283ba3f0515594 (plain) (blame)
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
72
73
74
75
{
  lib,
  buildPythonPackage,
  pythonOlder,
  fetchPypi,
  poetry-core,
  colorlog,
  dataclasses-json,
  langid,
  nltk,
  numpy,
  pandas,
  psutil,
  py3langid,
  python-dateutil,
  scipy,
  toml,
  nltk-data,
  symlinkJoin,
}:
let
  testNltkData = symlinkJoin {
    name = "nltk-test-data";
    paths = [
      nltk-data.punkt
      nltk-data.stopwords
    ];
  };
in
buildPythonPackage rec {
  pname = "type-infer";
  version = "0.0.20";
  format = "pyproject";

  disabled = pythonOlder "3.8";

  # using PyPI because the repo does not have tags or release branches
  src = fetchPypi {
    pname = "type_infer";
    inherit version;
    hash = "sha256-F+gfA7ofrbMEE5SrVt9H3s2mZKQLyr6roNUmL4EMJbI=";
  };

  nativeBuildInputs = [ poetry-core ];

  propagatedBuildInputs = [
    colorlog
    dataclasses-json
    langid
    nltk
    numpy
    pandas
    psutil
    py3langid
    python-dateutil
    scipy
    toml
  ];

  # PyPI package does not include tests
  doCheck = false;

  # Package import requires NLTK data to be downloaded
  # It is the only way to set NLTK_DATA environment variable,
  # so that it is available in pythonImportsCheck
  env.NLTK_DATA = testNltkData;
  pythonImportsCheck = [ "type_infer" ];

  meta = with lib; {
    description = "Automated type inference for Machine Learning pipelines";
    homepage = "https://pypi.org/project/type-infer/";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ mbalatsko ];
  };
}