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 ] ++ lib.flatten (lib.attrValues optional-dependencies); 88 89 preCheck = '' 90 export HOME=$TMPDIR 91 ''; 92 93 pytestFlagsArray = [ 94 # this file tries importing `deepspeed`, which is not yet packaged in nixpkgs 95 "--ignore=tests/test_huggingface_api.py" 96 ]; 97 98 disabledTests = [ 99 # Tests require DB access 100 "test_init" 101 "test_key_get_and_set" 102 "test_get" 103 # Tests require network access 104 "test_abatch_run" 105 "test_batch_run" 106 "test_retry_handling" 107 "test_run_chat" 108 "test_run" 109 "test_score_run" 110 # Test is time-sensitive 111 "test_timing" 112 ]; 113 114 pythonImportsCheck = [ "manifest" ]; 115 116 meta = with lib; { 117 description = "Manifest for Prompting Foundation Models"; 118 homepage = "https://github.com/HazyResearch/manifest"; 119 changelog = "https://github.com/HazyResearch/manifest/releases/tag/v${version}"; 120 license = licenses.asl20; 121 maintainers = with maintainers; [ natsukium ]; 122 }; 123}