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