1{ lib
2, backoff
3, buildPythonPackage
4, fetchFromGitHub
5, geojson
6, google-api-core
7, imagesize
8, nbconvert
9, nbformat
10, ndjson
11, numpy
12, opencv
13 # , opencv-python
14, packaging
15, pillow
16, pydantic
17 # , pygeotile
18, pyproj
19, pytest-cases
20, pytestCheckHook
21, pythonOlder
22, pythonRelaxDepsHook
23, rasterio
24, requests
25, shapely
26, tqdm
27, typeguard
28, typing-extensions
29}:
30
31buildPythonPackage rec {
32 pname = "labelbox";
33 version = "3.52.0";
34 format = "setuptools";
35
36 disabled = pythonOlder "3.7";
37
38 src = fetchFromGitHub {
39 owner = "Labelbox";
40 repo = "labelbox-python";
41 rev = "refs/tags/v.${version}";
42 hash = "sha256-t0Q+6tnUPK2oqjdAwwYeSebgn2EQ1fBivw115L8ndOg=";
43 };
44
45 postPatch = ''
46 substituteInPlace pytest.ini \
47 --replace "--reruns 5 --reruns-delay 10" ""
48 '';
49
50 nativeBuildInputs = [
51 pythonRelaxDepsHook
52 ];
53
54 pythonRelaxDeps = [
55 "backoff"
56 ];
57
58 propagatedBuildInputs = [
59 backoff
60 google-api-core
61 ndjson
62 pydantic
63 requests
64 tqdm
65 ];
66
67 passthru.optional-dependencies = {
68 data = [
69 shapely
70 geojson
71 numpy
72 pillow
73 # opencv-python
74 typeguard
75 imagesize
76 pyproj
77 # pygeotile
78 typing-extensions
79 packaging
80 ];
81 };
82
83 nativeCheckInputs = [
84 nbconvert
85 nbformat
86 pytest-cases
87 pytestCheckHook
88 ] ++ passthru.optional-dependencies.data;
89
90 disabledTestPaths = [
91 # Requires network access
92 "tests/integration"
93 # Missing requirements
94 "tests/data"
95 ];
96
97 pytestFlagsArray = [
98 # see tox.ini
99 "-k 'not notebooks'"
100 ];
101
102 pythonImportsCheck = [
103 "labelbox"
104 ];
105
106 meta = with lib; {
107 description = "Platform API for LabelBox";
108 homepage = "https://github.com/Labelbox/labelbox-python";
109 changelog = "https://github.com/Labelbox/labelbox-python/blob/v.${version}/CHANGELOG.md";
110 license = licenses.asl20;
111 maintainers = with maintainers; [ rakesh4g ];
112 };
113}