1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 poetry-core,
6 pytestCheckHook,
7}:
8
9buildPythonPackage rec {
10 pname = "timing-asgi";
11 version = "0.3.1";
12 pyproject = true;
13
14 src = fetchFromGitHub {
15 owner = "steinnes";
16 repo = "timing-asgi";
17 tag = "v${version}";
18 hash = "sha256-oEDesmy9t2m51Zd6Zg87qoYbfbDnejfrbjyBkZ3hF58=";
19 };
20
21 # The current pyproject.toml content is not compatible with poetry-core==2.0
22 postPatch = ''
23 substituteInPlace pyproject.toml \
24 --replace-fail "[tool.poetry]" "[project]" \
25 --replace-fail \
26 '"Steinn Eldjárn Sigurðarson <steinnes@gmail.com>"' \
27 '{ name = "Steinn Eldjárn Sigurðarson", email = "steinnes@gmail.com" },' \
28 --replace-fail poetry.masonry.api poetry.core.masonry.api \
29 --replace-fail "poetry>=" "poetry-core>="
30 '';
31
32 build-system = [ poetry-core ];
33
34 pythonImportsCheck = [ "timing_asgi" ];
35
36 # Tests rely on asynctest which is not supported by python 3.11
37 doCheck = false;
38
39 nativeCheckInputs = [
40 # asynctest-0.13.0 not supported for interpreter python3.11
41 # asynctest
42 pytestCheckHook
43 ];
44
45 meta = {
46 description = "ASGI middleware to emit timing metrics with something like statsd";
47 homepage = "https://pypi.org/project/timing-asgi";
48 license = lib.licenses.mit;
49 maintainers = with lib.maintainers; [ GaetanLepage ];
50 };
51}