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 '';
31
32 nativeBuildInputs = [ poetry-core ];
33
34 propagatedBuildInputs = [
35 hyperopt
36 prometheus_client
37 numpy
38 ];
39
40 checkInputs = [
41 mock
42 requests
43 pytestCheckHook
44 ];
45
46 preCheck = ''
47 export HOSTNAME=myhost-experimentId
48 '';
49
50 disabledTests = [
51 "test_add_metrics_pushes_metrics" # requires a working prometheus push gateway
52 ];
53
54 pythonImportsCheck = [ "gradient_utils" ];
55
56 meta = with lib; {
57 description = "Python utils and helpers library for Gradient";
58 homepage = "https://github.com/Paperspace/gradient-utils";
59 license = licenses.mit;
60 platforms = platforms.unix;
61 maintainers = with maintainers; [ freezeboy ];
62 };
63}