1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 geojson,
6 google-api-core,
7 hatchling,
8 imagesize,
9 mypy,
10 nbconvert,
11 nbformat,
12 numpy,
13 opencv-python-headless,
14 pillow,
15 pydantic,
16 pyproj,
17 pytest-cov-stub,
18 pytest-order,
19 pytest-rerunfailures,
20 pytest-xdist,
21 pytestCheckHook,
22 python-dateutil,
23 requests,
24 shapely,
25 strenum,
26 tqdm,
27 typeguard,
28 typing-extensions,
29}:
30
31let
32 version = "7.2.0";
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "Labelbox";
37 repo = "labelbox-python";
38 tag = "v${version}";
39 hash = "sha256-2of/yiw+wBHc0BFLKFdWV4Xm1Dcs4SsT8DkpmruaLT0=";
40 };
41
42 lbox-clients = buildPythonPackage {
43 inherit src version pyproject;
44
45 pname = "lbox-clients";
46
47 sourceRoot = "${src.name}/libs/lbox-clients";
48
49 build-system = [ hatchling ];
50
51 dependencies = [
52 google-api-core
53 requests
54 ];
55
56 nativeCheckInputs = [
57 pytestCheckHook
58 pytest-cov-stub
59 ];
60
61 doCheck = true;
62
63 __darwinAllowLocalNetworking = true;
64 };
65in
66buildPythonPackage rec {
67 inherit src version pyproject;
68
69 pname = "labelbox";
70
71 sourceRoot = "${src.name}/libs/labelbox";
72
73 pythonRelaxDeps = [
74 "mypy"
75 "python-dateutil"
76 ];
77
78 build-system = [ hatchling ];
79
80 dependencies = [
81 google-api-core
82 lbox-clients
83 pydantic
84 python-dateutil
85 requests
86 strenum
87 tqdm
88 geojson
89 mypy
90 ];
91
92 optional-dependencies = {
93 data = [
94 shapely
95 numpy
96 pillow
97 opencv-python-headless
98 typeguard
99 imagesize
100 pyproj
101 # pygeotile
102 typing-extensions
103 ];
104 };
105
106 nativeCheckInputs = [
107 nbconvert
108 nbformat
109 pytest-cov-stub
110 pytest-order
111 pytest-rerunfailures
112 pytest-xdist
113 pytestCheckHook
114 ]
115 ++ optional-dependencies.data;
116
117 disabledTestPaths = [
118 # Requires network access
119 "tests/integration"
120 # Missing requirements
121 "tests/data"
122 "tests/unit/test_label_data_type.py"
123 ];
124
125 doCheck = true;
126
127 __darwinAllowLocalNetworking = true;
128
129 pythonImportsCheck = [ "labelbox" ];
130
131 meta = {
132 description = "Platform API for LabelBox";
133 homepage = "https://github.com/Labelbox/labelbox-python";
134 changelog = "https://github.com/Labelbox/labelbox-python/releases/tag/v.${src.tag}";
135 license = lib.licenses.asl20;
136 maintainers = with lib.maintainers; [ rakesh4g ];
137 };
138}