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