1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pythonOlder,
7 pytestCheckHook,
8 devtools,
9 fastapi,
10 httpx,
11 poetry-core,
12 prometheus-client,
13 requests,
14 starlette,
15}:
16
17buildPythonPackage rec {
18 pname = "prometheus-fastapi-instrumentator";
19 version = "7.1.0";
20 pyproject = true;
21
22 disabled = pythonOlder "3.9";
23
24 src = fetchFromGitHub {
25 owner = "trallnag";
26 repo = "prometheus-fastapi-instrumentator";
27 tag = "v${version}";
28 hash = "sha256-54h/kwIdzFzxdYglwcEBPkLYno1YH2iWklg35qY2b00=";
29 };
30
31 build-system = [
32 poetry-core
33 ];
34
35 dependencies = [
36 prometheus-client
37 starlette
38 ];
39
40 nativeCheckInputs = [
41 devtools
42 fastapi
43 httpx
44 pytestCheckHook
45 requests
46 ];
47
48 # numerous test failures on Darwin
49 doCheck = stdenv.hostPlatform.isLinux;
50
51 pythonImportsCheck = [ "prometheus_fastapi_instrumentator" ];
52
53 meta = {
54 description = "Instrument FastAPI with Prometheus metrics";
55 homepage = "https://github.com/trallnag/prometheus-fastapi-instrumentator";
56 changelog = "https://github.com/trallnag/prometheus-fastapi-instrumentator/blob/${src.tag}/CHANGELOG.md";
57 license = with lib.licenses; [
58 isc
59 bsd3
60 ];
61 maintainers = with lib.maintainers; [ bcdarwin ];
62 platforms = lib.platforms.unix;
63 };
64}