1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 geojson,
6 google-api-core,
7 imagesize,
8 nbconvert,
9 nbformat,
10 numpy,
11 opencv4,
12 packaging,
13 pillow,
14 pydantic,
15 pyproj,
16 pytestCheckHook,
17 python-dateutil,
18 pythonOlder,
19 requests,
20 setuptools,
21 shapely,
22 strenum,
23 tqdm,
24 typeguard,
25 typing-extensions,
26}:
27
28buildPythonPackage rec {
29 pname = "labelbox";
30 version = "3.72.2";
31 pyproject = true;
32
33 disabled = pythonOlder "3.8";
34
35 src = fetchFromGitHub {
36 owner = "Labelbox";
37 repo = "labelbox-python";
38 rev = "refs/tags/v.${version}";
39 hash = "sha256-gor1LFT/XrWxWPwGn8lOkF46p/yrRILZp6fpeV+xvto=";
40 };
41
42 postPatch = ''
43 substituteInPlace pytest.ini \
44 --replace-fail "--reruns 2 --reruns-delay 10 --durations=20 -n 10" ""
45
46 # disable pytest_plugins which requires `pygeotile`
47 substituteInPlace tests/conftest.py \
48 --replace-fail "pytest_plugins" "_pytest_plugins"
49 '';
50
51
52 pythonRelaxDeps = [ "python-dateutil" ];
53
54 build-system = [ setuptools ];
55
56 dependencies = [
57 google-api-core
58 pydantic
59 python-dateutil
60 requests
61 strenum
62 tqdm
63 ];
64
65 optional-dependencies = {
66 data = [
67 shapely
68 geojson
69 numpy
70 pillow
71 opencv4
72 typeguard
73 imagesize
74 pyproj
75 # pygeotile
76 typing-extensions
77 packaging
78 ];
79 };
80
81 nativeCheckInputs = [
82 nbconvert
83 nbformat
84 pytestCheckHook
85 ] ++ optional-dependencies.data;
86
87 disabledTestPaths = [
88 # Requires network access
89 "tests/integration"
90 # Missing requirements
91 "tests/data"
92 ];
93
94 pythonImportsCheck = [ "labelbox" ];
95
96 meta = with lib; {
97 description = "Platform API for LabelBox";
98 homepage = "https://github.com/Labelbox/labelbox-python";
99 changelog = "https://github.com/Labelbox/labelbox-python/blob/v.${version}/CHANGELOG.md";
100 license = licenses.asl20;
101 maintainers = with maintainers; [ rakesh4g ];
102 };
103}