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