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