about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/manifest-ml/default.nix
blob: 8bc2710c5a436ec07294c208e49b887f193dc7ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{ lib
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, numpy
, pydantic
, redis
, requests
, aiohttp
, sqlitedict
, tenacity
, tiktoken
, xxhash
, # optional dependencies
  accelerate
, flask
, sentence-transformers
, torch
, transformers
, fastapi
, uvicorn
, pillow
, pg8000
, sqlalchemy
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "manifest-ml";
  version = "0.1.8";
  format = "setuptools";

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "HazyResearch";
    repo = "manifest";
    rev = "refs/tags/v${version}";
    hash = "sha256-d34TIZYDB8EDEIZUH5mDzfDHzFT290DwjPLJkNneklc=";
  };

  __darwinAllowLocalNetworking = true;

  propagatedBuildInputs = [
    numpy
    pydantic
    redis
    requests
    aiohttp
    sqlitedict
    tenacity
    tiktoken
    xxhash
  ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);

  passthru.optional-dependencies = {
    api = [
      accelerate
      # deepspeed
      # diffusers
      flask
      sentence-transformers
      torch
      transformers
    ];
    app = [
      fastapi
      uvicorn
    ];
    diffusers = [
      pillow
    ];
    gcp = [
      pg8000
      # cloud-sql-python-connector
      sqlalchemy
    ];
  };

  nativeCheckInputs = [
    pytestCheckHook
  ];

  preCheck = ''
    export HOME=$TMPDIR
  '';

  pytestFlagsArray = [
    # this file tries importing `deepspeed`, which is not yet packaged in nixpkgs
    "--ignore=tests/test_huggingface_api.py"
  ];

  disabledTests = [
    # these tests have db access
    "test_init"
    "test_key_get_and_set"
    "test_get"
    # this test has network access
    "test_retry_handling"
    # Test is time-senstive
    "test_timing"
  ];

  pythonImportsCheck = [
    "manifest"
  ];

  meta = with lib; {
    description = "Manifest for Prompting Foundation Models";
    homepage = "https://github.com/HazyResearch/manifest";
    changelog = "https://github.com/HazyResearch/manifest/releases/tag/v${version}";
    license = licenses.asl20;
    maintainers = with maintainers; [ natsukium ];
  };
}