Merge pull request #293068 from azahi/krr

krr: init at 1.7.0
This commit is contained in:
Mario Rodas 2024-03-04 21:08:14 -05:00 committed by GitHub
commit 71d9c3b424
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 196 additions and 0 deletions

View File

@ -0,0 +1,68 @@
{ lib
, python3
, fetchFromGitHub
, testers
, krr
}:
python3.pkgs.buildPythonPackage rec {
pname = "krr";
version = "1.7.0";
pyproject = true;
src = fetchFromGitHub {
owner = "robusta-dev";
repo = "krr";
rev = "refs/tags/v${version}";
hash = "sha256-8K97v/8lsLqr88MSOT3peOy0GZp1so9GaipG/t2uR88=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail 'aiostream = "^0.4.5"' 'aiostream = "*"' \
--replace-fail 'kubernetes = "^26.1.0"' 'kubernetes = "*"' \
--replace-fail 'pydantic = "1.10.7"' 'pydantic = "*"' \
--replace-fail 'typer = { extras = ["all"], version = "^0.7.0" }' 'typer = { extras = ["all"], version = "*" }'
'';
propagatedBuildInputs = with python3.pkgs; [
aiostream
alive-progress
kubernetes
numpy
poetry-core
prometheus-api-client
prometrix
pydantic_1
slack-sdk
typer
] ++ typer.optional-dependencies.all;
nativeCheckInputs = with python3.pkgs; [
pytestCheckHook
];
pythonImportsCheck = [
"robusta_krr"
];
passthru.tests.version = testers.testVersion {
package = krr;
command = "krr version";
};
meta = with lib; {
description = "Prometheus-based Kubernetes resource recommendations";
longDescription = ''
Robusta KRR (Kubernetes Resource Recommender) is a CLI tool for optimizing
resource allocation in Kubernetes clusters. It gathers Pod usage data from
Prometheus and recommends requests and limits for CPU and memory. This
reduces costs and improves performance.
'';
homepage = "https://github.com/robusta-dev/krr";
changelog = "https://github.com/robusta-dev/krr/releases/tag/v${src.rev}";
license = licenses.mit;
maintainers = with lib.maintainers; [ azahi ];
mainProgram = "krr";
};
}

View File

@ -0,0 +1,62 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, pytestCheckHook
, dateparser
, httmock
, matplotlib
, numpy
, pandas
, requests
}:
buildPythonPackage rec {
pname = "prometheus-api-client";
version = "0.5.5";
format = "setuptools";
src = fetchFromGitHub {
owner = "4n4nd";
repo = "prometheus-api-client-python";
rev = "refs/tags/v${version}";
hash = "sha256-tUu0+ZUOFxBCj//lHhNm88rhFbS01j1x508+nqIkCfQ=";
};
propagatedBuildInputs = [
dateparser
matplotlib
numpy
pandas
requests
];
nativeCheckInputs = [
pytestCheckHook
];
checkInputs = [
httmock
];
disabledTestPaths = [
"tests/test_prometheus_connect.py"
];
pythonImportsCheck = [
"prometheus_api_client"
];
meta = with lib; {
description = "A Python wrapper for the Prometheus HTTP API";
longDescription = ''
The prometheus-api-client library consists of multiple modules which
assist in connecting to a Prometheus host, fetching the required metrics
and performing various aggregation operations on the time series data.
'';
homepage = "https://github.com/4n4nd/prometheus-api-client-python";
changelog = "https://github.com/4n4nd/prometheus-api-client-python/blob/${src.rev}/CHANGELOG.md";
license = licenses.mit;
maintainers = with maintainers; [ azahi ];
};
}

View File

@ -0,0 +1,62 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, boto3
, botocore
, dateparser
, matplotlib
, numpy
, pandas
, poetry-core
, prometheus-api-client
, pydantic_1
, requests
}:
buildPythonPackage rec {
pname = "prometrix";
version = "unstable-2024-02-20";
format = "pyproject";
src = fetchFromGitHub {
owner = "robusta-dev";
repo = "prometrix";
rev = "ab2dad2192ed3df91c1a25446a4f54b8f2f6742f";
hash = "sha256-/72Qkd2BojYgiQi5rq7dVsEje7M0aQQXhenvIM7lSy4=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail 'pydantic = "^1.8.1"' 'pydantic = "*"'
'';
propagatedBuildInputs = [
boto3
botocore
dateparser
matplotlib
numpy
pandas
prometheus-api-client
pydantic_1
requests
];
nativeBuildInputs = [
poetry-core
];
pythonImportsCheck = [
"prometrix"
];
meta = with lib; {
description = "Unified Prometheus client";
longDescription = ''
This Python package provides a unified Prometheus client that can be used
to connect to and query various types of Prometheus instances.
'';
license = licenses.mit;
maintainers = with maintainers; [ azahi ];
};
}

View File

@ -10049,10 +10049,14 @@ self: super: with self; {
progress = callPackage ../development/python-modules/progress { };
prometheus-api-client = callPackage ../development/python-modules/prometheus-api-client { };
prometheus-client = callPackage ../development/python-modules/prometheus-client { };
prometheus-flask-exporter = callPackage ../development/python-modules/prometheus-flask-exporter { };
prometrix = callPackage ../development/python-modules/prometrix { };
promise = callPackage ../development/python-modules/promise { };
prompt-toolkit = callPackage ../development/python-modules/prompt-toolkit { };