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