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