1{
2 lib,
3 accelerate,
4 aiohttp,
5 buildPythonPackage,
6 fastapi,
7 fetchFromGitHub,
8 flask,
9 numpy,
10 pg8000,
11 pillow,
12 pydantic,
13 pytestCheckHook,
14 pythonOlder,
15 redis,
16 requests,
17 sentence-transformers,
18 setuptools,
19 sqlalchemy,
20 sqlitedict,
21 tenacity,
22 tiktoken,
23 torch,
24 transformers,
25 uvicorn,
26 xxhash,
27}:
28
29buildPythonPackage rec {
30 pname = "manifest-ml";
31 version = "0.1.9";
32 pyproject = true;
33
34 disabled = pythonOlder "3.8";
35
36 src = fetchFromGitHub {
37 owner = "HazyResearch";
38 repo = "manifest";
39 tag = "v${version}";
40 hash = "sha256-6m1XZOXzflBYyq9+PinbrW+zqvNGFN/aRDHH1b2Me5E=";
41 };
42
43 __darwinAllowLocalNetworking = true;
44
45 pythonRelaxDeps = [ "pydantic" ];
46
47 build-system = [
48 setuptools
49 ];
50
51 dependencies = [
52 numpy
53 pydantic
54 redis
55 requests
56 aiohttp
57 sqlitedict
58 tenacity
59 tiktoken
60 xxhash
61 ];
62
63 optional-dependencies = {
64 api = [
65 accelerate
66 # deepspeed
67 # diffusers
68 flask
69 sentence-transformers
70 torch
71 transformers
72 ];
73 app = [
74 fastapi
75 uvicorn
76 ];
77 diffusers = [ pillow ];
78 gcp = [
79 pg8000
80 # cloud-sql-python-connector
81 sqlalchemy
82 ];
83 };
84
85 nativeCheckInputs = [
86 pytestCheckHook
87 ]
88 ++ lib.flatten (lib.attrValues optional-dependencies);
89
90 preCheck = ''
91 export HOME=$TMPDIR
92 '';
93
94 disabledTestPaths = [
95 # this file tries importing `deepspeed`, which is not yet packaged in nixpkgs
96 "tests/test_huggingface_api.py"
97 ];
98
99 disabledTests = [
100 # Tests require DB access
101 "test_init"
102 "test_key_get_and_set"
103 "test_get"
104 # Tests require network access
105 "test_abatch_run"
106 "test_batch_run"
107 "test_retry_handling"
108 "test_run_chat"
109 "test_run"
110 "test_score_run"
111 # Test is time-sensitive
112 "test_timing"
113 ];
114
115 pythonImportsCheck = [ "manifest" ];
116
117 meta = with lib; {
118 description = "Manifest for Prompting Foundation Models";
119 homepage = "https://github.com/HazyResearch/manifest";
120 changelog = "https://github.com/HazyResearch/manifest/releases/tag/v${version}";
121 license = licenses.asl20;
122 maintainers = with maintainers; [ natsukium ];
123 };
124}