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 = "6.10.0";
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "Labelbox";
37 repo = "labelbox-python";
38 tag = "v.${version}";
39 hash = "sha256-EstHsY9yFeUhQAx3pgvKk/o3EMkr3JeHDDg/p6meDIE=";
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 postPatch = ''
52 substituteInPlace pyproject.toml \
53 --replace "--durations=20 --cov=lbox.example" "--durations=20"
54 '';
55
56 dependencies = [
57 google-api-core
58 requests
59 ];
60
61 nativeCheckInputs = [
62 pytestCheckHook
63 ];
64
65 doCheck = true;
66
67 __darwinAllowLocalNetworking = true;
68 };
69in
70buildPythonPackage rec {
71 inherit src version pyproject;
72
73 pname = "labelbox";
74
75 sourceRoot = "${src.name}/libs/labelbox";
76
77 pythonRelaxDeps = [
78 "mypy"
79 "python-dateutil"
80 ];
81
82 build-system = [ hatchling ];
83
84 dependencies = [
85 google-api-core
86 lbox-clients
87 pydantic
88 python-dateutil
89 requests
90 strenum
91 tqdm
92 geojson
93 mypy
94 ];
95
96 optional-dependencies = {
97 data = [
98 shapely
99 numpy
100 pillow
101 opencv-python-headless
102 typeguard
103 imagesize
104 pyproj
105 # pygeotile
106 typing-extensions
107 ];
108 };
109
110 nativeCheckInputs = [
111 nbconvert
112 nbformat
113 pytest-cov-stub
114 pytest-order
115 pytest-rerunfailures
116 pytest-xdist
117 pytestCheckHook
118 ] ++ optional-dependencies.data;
119
120 disabledTestPaths = [
121 # Requires network access
122 "tests/integration"
123 # Missing requirements
124 "tests/data"
125 "tests/unit/test_label_data_type.py"
126 ];
127
128 doCheck = true;
129
130 __darwinAllowLocalNetworking = true;
131
132 pythonImportsCheck = [ "labelbox" ];
133
134 meta = {
135 description = "Platform API for LabelBox";
136 homepage = "https://github.com/Labelbox/labelbox-python";
137 changelog = "https://github.com/Labelbox/labelbox-python/releases/tag/v.${src.tag}";
138 license = lib.licenses.asl20;
139 maintainers = with lib.maintainers; [ rakesh4g ];
140 };
141}