1{
2 lib,
3 buildPythonPackage,
4 clarifai-grpc,
5 fetchFromGitHub,
6 inquirerpy,
7 numpy,
8 pillow,
9 pycocotools,
10 pytestCheckHook,
11 pythonOlder,
12 pyyaml,
13 rich,
14 schema,
15 setuptools,
16 tabulate,
17 tqdm,
18 tritonclient,
19}:
20
21buildPythonPackage rec {
22 pname = "clarifai";
23 version = "10.8.6";
24 pyproject = true;
25
26 disabled = pythonOlder "3.8";
27
28 src = fetchFromGitHub {
29 owner = "Clarifai";
30 repo = "clarifai-python";
31 rev = "refs/tags/${version}";
32 hash = "sha256-/fHNRFtxyNa9VdEi5wQ+YA+9mFv3ZpRFJQnWkuxQd5I=";
33 };
34
35 pythonRelaxDeps = [
36 "clarifai-grpc"
37 "schema"
38 ];
39
40 build-system = [ setuptools ];
41
42 dependencies = [
43 clarifai-grpc
44 inquirerpy
45 numpy
46 pillow
47 pyyaml
48 rich
49 schema
50 tabulate
51 tqdm
52 tritonclient
53 ];
54
55 optional-dependencies = {
56 all = [ pycocotools ];
57 };
58
59 nativeCheckInputs = [ pytestCheckHook ];
60
61 preCheck = ''
62 export HOME=$(mktemp -d)
63 '';
64
65 disabledTests = [
66 # Test requires network access and API key
67 "test_export_workflow_general"
68 "test_validate_invalid_id"
69 "test_validate_invalid_hex_id"
70 ];
71
72 disabledTestPaths = [
73 # Tests require network access and API key
74 "tests/test_app.py"
75 "tests/test_data_upload.py"
76 "tests/test_eval.py"
77 "tests/test_model_predict.py"
78 "tests/test_model_train.py"
79 "tests/test_search.py"
80 "tests/workflow/test_create_delete.py"
81 "tests/workflow/test_predict.py"
82 "tests/test_rag.py"
83 "clarifai/models/model_serving/repo_build/static_files/base_test.py"
84 ];
85
86 pythonImportsCheck = [ "clarifai" ];
87
88 meta = with lib; {
89 description = "Clarifai Python Utilities";
90 homepage = "https://github.com/Clarifai/clarifai-python";
91 changelog = "https://github.com/Clarifai/clarifai-python/releases/tag/${version}";
92 license = licenses.asl20;
93 maintainers = with maintainers; [ natsukium ];
94 mainProgram = "clarifai";
95 };
96}