2021-03-19 17:17:44 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2021-02-05 17:12:51 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, hyperopt
|
|
|
|
, mock
|
|
|
|
, numpy
|
2021-03-19 17:17:44 +00:00
|
|
|
, poetry-core
|
2021-08-27 14:25:00 +00:00
|
|
|
, prometheus-client
|
2021-02-05 17:12:51 +00:00
|
|
|
, pytestCheckHook
|
2021-03-19 17:17:44 +00:00
|
|
|
, requests
|
2021-02-05 17:12:51 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "gradient-utils";
|
2021-12-26 17:43:05 +00:00
|
|
|
version = "0.5.0";
|
2021-02-05 17:12:51 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Paperspace";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-12-26 17:43:05 +00:00
|
|
|
sha256 = "19plkgwwfs6298vjplgsvhirixi3jbngq5y07x9c0fjxk39fa2dk";
|
2021-02-05 17:12:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
|
|
|
--replace 'numpy = "1.18.5"' 'numpy = "^1.18.5"' \
|
2021-03-19 17:17:44 +00:00
|
|
|
--replace 'hyperopt = "0.1.2"' 'hyperopt = ">=0.1.2"' \
|
2021-08-27 14:25:00 +00:00
|
|
|
--replace 'wheel = "^0.35.1"' 'wheel = "*"' \
|
|
|
|
--replace 'prometheus-client = ">=0.8,<0.10"' 'prometheus-client = "*"'
|
2021-02-05 17:12:51 +00:00
|
|
|
'';
|
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
nativeBuildInputs = [ poetry-core ];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
hyperopt
|
2021-08-27 14:25:00 +00:00
|
|
|
prometheus-client
|
2021-03-19 17:17:44 +00:00
|
|
|
numpy
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
mock
|
|
|
|
requests
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export HOSTNAME=myhost-experimentId
|
|
|
|
'';
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
"test_add_metrics_pushes_metrics" # requires a working prometheus push gateway
|
|
|
|
];
|
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
pythonImportsCheck = [ "gradient_utils" ];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2021-03-19 17:17:44 +00:00
|
|
|
description = "Python utils and helpers library for Gradient";
|
|
|
|
homepage = "https://github.com/Paperspace/gradient-utils";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
2021-02-05 17:12:51 +00:00
|
|
|
maintainers = with maintainers; [ freezeboy ];
|
|
|
|
};
|
|
|
|
}
|