2021-03-16 09:30:55 +01:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2021-01-31 18:38:10 +01:00
|
|
|
, fetchFromGitHub
|
2021-01-23 04:43:02 +01:00
|
|
|
, hyperopt
|
2021-01-31 18:38:10 +01:00
|
|
|
, mock
|
2021-01-23 04:43:02 +01:00
|
|
|
, numpy
|
2021-03-16 09:30:55 +01:00
|
|
|
, poetry-core
|
2021-07-02 12:17:58 +02:00
|
|
|
, prometheus-client
|
2021-01-31 18:38:10 +01:00
|
|
|
, pytestCheckHook
|
2021-03-16 09:30:55 +01:00
|
|
|
, requests
|
2021-01-23 04:43:02 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "gradient-utils";
|
|
|
|
version = "0.3.2";
|
2021-01-31 18:38:10 +01:00
|
|
|
format = "pyproject";
|
2021-01-23 04:43:02 +01:00
|
|
|
|
2021-01-31 18:38:10 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Paperspace";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "083hnkv19mhvdc8nx28f1nph50c903gxh9g9q8531abv0w8m0744";
|
2021-01-23 04:43:02 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
2021-01-31 18:38:10 +01:00
|
|
|
substituteInPlace pyproject.toml \
|
|
|
|
--replace 'numpy = "1.18.5"' 'numpy = "^1.18.5"' \
|
2021-03-16 09:30:55 +01:00
|
|
|
--replace 'hyperopt = "0.1.2"' 'hyperopt = ">=0.1.2"' \
|
2021-07-02 12:17:58 +02:00
|
|
|
--replace 'wheel = "^0.35.1"' 'wheel = "*"' \
|
|
|
|
--replace 'prometheus-client = ">=0.8,<0.10"' 'prometheus-client = "*"'
|
2021-01-23 04:43:02 +01:00
|
|
|
'';
|
|
|
|
|
2021-03-16 09:30:55 +01:00
|
|
|
nativeBuildInputs = [ poetry-core ];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
hyperopt
|
2021-07-02 12:17:58 +02:00
|
|
|
prometheus-client
|
2021-03-16 09:30:55 +01:00
|
|
|
numpy
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
mock
|
|
|
|
requests
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export HOSTNAME=myhost-experimentId
|
|
|
|
'';
|
2021-01-23 04:43:02 +01:00
|
|
|
|
2021-01-31 18:38:10 +01:00
|
|
|
disabledTests = [
|
|
|
|
"test_add_metrics_pushes_metrics" # requires a working prometheus push gateway
|
|
|
|
];
|
2021-01-23 04:43:02 +01:00
|
|
|
|
2021-03-16 09:30:55 +01:00
|
|
|
pythonImportsCheck = [ "gradient_utils" ];
|
|
|
|
|
2021-01-23 04:43:02 +01:00
|
|
|
meta = with lib; {
|
2021-03-16 09:30:55 +01:00
|
|
|
description = "Python utils and helpers library for Gradient";
|
|
|
|
homepage = "https://github.com/Paperspace/gradient-utils";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
2021-01-23 04:43:02 +01:00
|
|
|
maintainers = with maintainers; [ freezeboy ];
|
|
|
|
};
|
|
|
|
}
|