1{
2 lib,
3 aiohttp,
4 aresponses,
5 awesomeversion,
6 backoff,
7 buildPythonPackage,
8 fetchFromGitHub,
9 fetchpatch,
10 poetry-core,
11 pydantic,
12 pytest-asyncio,
13 pytestCheckHook,
14 pythonOlder,
15 pythonRelaxDepsHook,
16 yarl,
17}:
18
19buildPythonPackage rec {
20 pname = "demetriek";
21 version = "0.4.0";
22 pyproject = true;
23
24 disabled = pythonOlder "3.9";
25
26 src = fetchFromGitHub {
27 owner = "frenck";
28 repo = "python-demetriek";
29 rev = "refs/tags/v${version}";
30 hash = "sha256-LCHHBcZgO9gw5jyaJiiS4lKyb0ut+PJvKTylIvIKHhc=";
31 };
32
33 patches = [
34 # https://github.com/frenck/python-demetriek/pull/531
35 (fetchpatch {
36 name = "pydantic_2-compatibility.patch";
37 url = "https://github.com/frenck/python-demetriek/commit/e677fe5b735b6b28572e3e5fd6aab56fc056f5e6.patch";
38 excludes = [
39 "pyproject.toml"
40 "poetry.lock"
41 ];
42 hash = "sha256-oMVR45KHDhcPId/0X9obJXCPE8s1gk5IgsGsgZesdZw=";
43 })
44 ];
45
46 postPatch = ''
47 # Upstream doesn't set a version for the pyproject.toml
48 substituteInPlace pyproject.toml \
49 --replace "0.0.0" "${version}" \
50 --replace "--cov" ""
51 '';
52
53 pythonRelaxDeps = [ "pydantic" ];
54
55 nativeBuildInputs = [
56 poetry-core
57 pythonRelaxDepsHook
58 ];
59
60 propagatedBuildInputs = [
61 aiohttp
62 awesomeversion
63 backoff
64 pydantic
65 yarl
66 ];
67
68 nativeCheckInputs = [
69 aresponses
70 pytest-asyncio
71 pytestCheckHook
72 ];
73
74 pythonImportsCheck = [ "demetriek" ];
75
76 __darwinAllowLocalNetworking = true;
77
78 meta = with lib; {
79 description = "Python client for LaMetric TIME devices";
80 homepage = "https://github.com/frenck/python-demetriek";
81 changelog = "https://github.com/frenck/python-demetriek/releases/tag/v${version}";
82 license = licenses.mit;
83 maintainers = with maintainers; [ fab ];
84 };
85}