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 = "refs/tags/v${version}";
25 hash = "sha256-swnl0phdOsBSP8AX/OySI/aYI9z60Ss3SsJox/mb9KY=";
26 };
27
28 nativeBuildInputs = [
29 poetry-core
30 ];
31
32 propagatedBuildInputs = [
33 hyperopt
34 prometheus-client
35 numpy
36 ];
37
38 nativeCheckInputs = [
39 mock
40 requests
41 pytestCheckHook
42 ];
43
44 postPatch = ''
45 # https://github.com/Paperspace/gradient-utils/issues/68
46 # https://github.com/Paperspace/gradient-utils/issues/72
47 substituteInPlace pyproject.toml \
48 --replace 'wheel = "^0.35.1"' 'wheel = "*"' \
49 --replace 'prometheus-client = ">=0.8,<0.10"' 'prometheus-client = "*"' \
50 --replace 'pymongo = "^3.11.0"' 'pymongo = ">=3.11.0"'
51 '';
52
53 preCheck = ''
54 export HOSTNAME=myhost-experimentId
55 '';
56
57 disabledTestPaths = [
58 # Requires a working Prometheus push gateway
59 "tests/integration/test_metrics.py"
60 ];
61
62 pythonImportsCheck = [
63 "gradient_utils"
64 ];
65
66 meta = with lib; {
67 description = "Python utils and helpers library for Gradient";
68 homepage = "https://github.com/Paperspace/gradient-utils";
69 license = licenses.mit;
70 maintainers = with maintainers; [ freezeboy ];
71 platforms = platforms.unix;
72 };
73}