summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/timing-asgi/default.nix
blob: 00729718e9e640fb862a8697b15a2da826b2925e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  poetry-core,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "timing-asgi";
  version = "0.3.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "steinnes";
    repo = "timing-asgi";
    tag = "v${version}";
    hash = "sha256-oEDesmy9t2m51Zd6Zg87qoYbfbDnejfrbjyBkZ3hF58=";
  };

  # The current pyproject.toml content is not compatible with poetry-core==2.0
  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "[tool.poetry]" "[project]" \
      --replace-fail \
        '"Steinn Eldjárn Sigurðarson <steinnes@gmail.com>"' \
        '{ name = "Steinn Eldjárn Sigurðarson", email = "steinnes@gmail.com" },' \
      --replace-fail poetry.masonry.api poetry.core.masonry.api \
      --replace-fail "poetry>=" "poetry-core>="
  '';

  build-system = [ poetry-core ];

  pythonImportsCheck = [ "timing_asgi" ];

  # Tests rely on asynctest which is not supported by python 3.11
  doCheck = false;

  nativeCheckInputs = [
    # asynctest-0.13.0 not supported for interpreter python3.11
    # asynctest
    pytestCheckHook
  ];

  meta = {
    description = "ASGI middleware to emit timing metrics with something like statsd";
    homepage = "https://pypi.org/project/timing-asgi";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ GaetanLepage ];
  };
}