1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, hyperopt
5, mock
6, numpy
7, poetry-core
8, prometheus-client
9, pytestCheckHook
10, requests
11}:
12
13buildPythonPackage rec {
14 pname = "gradient-utils";
15 version = "0.3.2";
16 format = "pyproject";
17
18 src = fetchFromGitHub {
19 owner = "Paperspace";
20 repo = pname;
21 rev = "v${version}";
22 sha256 = "083hnkv19mhvdc8nx28f1nph50c903gxh9g9q8531abv0w8m0744";
23 };
24
25 postPatch = ''
26 substituteInPlace pyproject.toml \
27 --replace 'numpy = "1.18.5"' 'numpy = "^1.18.5"' \
28 --replace 'hyperopt = "0.1.2"' 'hyperopt = ">=0.1.2"' \
29 --replace 'wheel = "^0.35.1"' 'wheel = "*"' \
30 --replace 'prometheus-client = ">=0.8,<0.10"' 'prometheus-client = "*"'
31 '';
32
33 nativeBuildInputs = [ poetry-core ];
34
35 propagatedBuildInputs = [
36 hyperopt
37 prometheus-client
38 numpy
39 ];
40
41 checkInputs = [
42 mock
43 requests
44 pytestCheckHook
45 ];
46
47 preCheck = ''
48 export HOSTNAME=myhost-experimentId
49 '';
50
51 disabledTests = [
52 "test_add_metrics_pushes_metrics" # requires a working prometheus push gateway
53 ];
54
55 pythonImportsCheck = [ "gradient_utils" ];
56
57 meta = with lib; {
58 description = "Python utils and helpers library for Gradient";
59 homepage = "https://github.com/Paperspace/gradient-utils";
60 license = licenses.mit;
61 platforms = platforms.unix;
62 maintainers = with maintainers; [ freezeboy ];
63 };
64}