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