Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / manifest-ml / default.nix
blob329f676ef45bc2ab9890b955c5b1ffb8770ffc94
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
28 buildPythonPackage rec {
29   pname = "manifest-ml";
30   version = "0.1.8";
31   format = "setuptools";
33   disalbed = pythonOlder "3.8";
35   src = fetchFromGitHub {
36     owner = "HazyResearch";
37     repo = "manifest";
38     rev = "refs/tags/v${version}";
39     hash = "sha256-d34TIZYDB8EDEIZUH5mDzfDHzFT290DwjPLJkNneklc=";
40   };
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);
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   };
78   nativeCheckInputs = [
79     pytestCheckHook
80   ];
82   preCheck = ''
83     export HOME=$TMPDIR
84   '';
86   pytestFlagsArray = [
87     # this file tries importing `deepspeed`, which is not yet packaged in nixpkgs
88     "--ignore=tests/test_huggingface_api.py"
89   ];
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     # Test is time-senstive
99     "test_timing"
100   ];
102   pythonImportsCheck = [
103     "manifest"
104   ];
106   meta = with lib; {
107     description = "Manifest for Prompting Foundation Models";
108     homepage = "https://github.com/HazyResearch/manifest";
109     changelog = "https://github.com/HazyResearch/manifest/releases/tag/v${version}";
110     license = licenses.asl20;
111     maintainers = with maintainers; [ natsukium ];
112   };