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