1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, numpy
6, pydantic
7, redis
8, requests
9, aiohttp
10, sqlitedict
11, tenacity
12, tiktoken
13, xxhash
14, # optional dependencies
15 accelerate
16, flask
17, sentence-transformers
18, torch
19, transformers
20, fastapi
21, uvicorn
22, pillow
23, pg8000
24, sqlalchemy
25, pytestCheckHook
26}:
27
28buildPythonPackage rec {
29 pname = "manifest-ml";
30 version = "0.1.7";
31 format = "setuptools";
32
33 disalbed = pythonOlder "3.8";
34
35 src = fetchFromGitHub {
36 owner = "HazyResearch";
37 repo = "manifest";
38 rev = "refs/tags/v${version}";
39 hash = "sha256-wrslrzMAPBVAlb4ieB+DcLfWjZdlaUBnGXbzcMhlf34=";
40 };
41
42 propagatedBuildInputs = [
43 numpy
44 pydantic
45 redis
46 requests
47 aiohttp
48 sqlitedict
49 tenacity
50 tiktoken
51 xxhash
52 ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
53
54 passthru.optional-dependencies = {
55 api = [
56 accelerate
57 # deepspeed
58 # diffusers
59 flask
60 sentence-transformers
61 torch
62 transformers
63 ];
64 app = [
65 fastapi
66 uvicorn
67 ];
68 diffusers = [
69 pillow
70 ];
71 gcp = [
72 pg8000
73 # cloud-sql-python-connector
74 sqlalchemy
75 ];
76 };
77
78 nativeCheckInputs = [
79 pytestCheckHook
80 ];
81
82 preCheck = ''
83 export HOME=$TMPDIR
84 '';
85
86 pytestFlagsArray = [
87 # this file tries importing `deepspeed`, which is not yet packaged in nixpkgs
88 "--ignore=tests/test_huggingface_api.py"
89 ];
90
91 disabledTests = [
92 # these tests have db access
93 "test_init"
94 "test_key_get_and_set"
95 "test_get"
96 # this test has network access
97 "test_retry_handling"
98 ];
99
100 meta = with lib; {
101 description = "Manifest for Prompting Foundation Models";
102 homepage = "https://github.com/HazyResearch/manifest";
103 changelog = "https://github.com/HazyResearch/manifest/releases/tag/v${version}";
104 license = licenses.asl20;
105 maintainers = with maintainers; [ natsukium ];
106 };
107}