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