1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 setuptools,
7 twisted,
8 pytestCheckHook,
9 pythonOlder,
10}:
11
12buildPythonPackage rec {
13 pname = "prometheus-client";
14 version = "0.22.1";
15 pyproject = true;
16
17 disabled = pythonOlder "3.8";
18
19 src = fetchFromGitHub {
20 owner = "prometheus";
21 repo = "client_python";
22 tag = "v${version}";
23 hash = "sha256-DEuIoVpRDJTd9qXBeHa5jrBscmGgosCKAluqCuUBzuU=";
24 };
25
26 build-system = [ setuptools ];
27
28 optional-dependencies.twisted = [ twisted ];
29
30 __darwinAllowLocalNetworking = true;
31
32 nativeCheckInputs = [ pytestCheckHook ] ++ lib.flatten (lib.attrValues optional-dependencies);
33
34 pythonImportsCheck = [ "prometheus_client" ];
35
36 disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
37 # fails in darwin sandbox: Operation not permitted
38 "test_instance_ip_grouping_key"
39 ];
40
41 meta = with lib; {
42 description = "Prometheus instrumentation library for Python applications";
43 homepage = "https://github.com/prometheus/client_python";
44 changelog = "https://github.com/prometheus/client_python/releases/tag/${src.tag}";
45 license = licenses.asl20;
46 maintainers = [ ];
47 };
48}