summary refs log tree commit diff
path: root/pkgs/development/python-modules/labelbox/default.nix
blob: c0b635abf4606290df3c2d4d3ab9e0e12f3a4105 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{ lib
, backoff
, buildPythonPackage
, fetchFromGitHub
, geojson
, google-api-core
, imagesize
, nbconvert
, nbformat
, ndjson
, numpy
, opencv
  # , opencv-python
, packaging
, pillow
, pydantic
  # , pygeotile
, pyproj
, pytest-cases
, pytestCheckHook
, pythonOlder
, pythonRelaxDepsHook
, rasterio
, requests
, shapely
, tqdm
, typeguard
, typing-extensions
}:

buildPythonPackage rec {
  pname = "labelbox";
  version = "3.52.0";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "Labelbox";
    repo = "labelbox-python";
    rev = "refs/tags/v.${version}";
    hash = "sha256-t0Q+6tnUPK2oqjdAwwYeSebgn2EQ1fBivw115L8ndOg=";
  };

  postPatch = ''
    substituteInPlace pytest.ini \
      --replace "--reruns 5 --reruns-delay 10" ""
  '';

  nativeBuildInputs = [
    pythonRelaxDepsHook
  ];

  pythonRelaxDeps = [
    "backoff"
  ];

  propagatedBuildInputs = [
    backoff
    google-api-core
    ndjson
    pydantic
    requests
    tqdm
  ];

  passthru.optional-dependencies = {
    data = [
      shapely
      geojson
      numpy
      pillow
      # opencv-python
      typeguard
      imagesize
      pyproj
      # pygeotile
      typing-extensions
      packaging
    ];
  };

  nativeCheckInputs = [
    nbconvert
    nbformat
    pytest-cases
    pytestCheckHook
  ] ++ passthru.optional-dependencies.data;

  disabledTestPaths = [
    # Requires network access
    "tests/integration"
    # Missing requirements
    "tests/data"
  ];

  pytestFlagsArray = [
    # see tox.ini
    "-k 'not notebooks'"
  ];

  pythonImportsCheck = [
    "labelbox"
  ];

  meta = with lib; {
    description = "Platform API for LabelBox";
    homepage = "https://github.com/Labelbox/labelbox-python";
    changelog = "https://github.com/Labelbox/labelbox-python/blob/v.${version}/CHANGELOG.md";
    license = licenses.asl20;
    maintainers = with maintainers; [ rakesh4g ];
  };
}