1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 pbr,
7 httpx,
8 pillow,
9 pycryptodome,
10 pyjwt,
11 pytest-asyncio,
12 pytestCheckHook,
13 python,
14 respx,
15 setuptools,
16 time-machine,
17 tzdata,
18}:
19
20buildPythonPackage rec {
21 pname = "bimmer-connected";
22 version = "0.17.3";
23 pyproject = true;
24
25 disabled = pythonOlder "3.8";
26
27 src = fetchFromGitHub {
28 owner = "bimmerconnected";
29 repo = "bimmer_connected";
30 tag = version;
31 hash = "sha256-XKKMOKvZO6CrAioflyhTWZrNJv1+5yqYPFL4Al8YPY8=";
32 };
33
34 build-system = [
35 pbr
36 setuptools
37 ];
38
39 PBR_VERSION = version;
40
41 dependencies = [
42 httpx
43 pycryptodome
44 pyjwt
45 ];
46
47 optional-dependencies = {
48 china = [ pillow ];
49 };
50
51 postInstall = ''
52 cp -R bimmer_connected/tests/responses $out/${python.sitePackages}/bimmer_connected/tests/
53 '';
54
55 nativeCheckInputs = [
56 pytest-asyncio
57 pytestCheckHook
58 respx
59 time-machine
60 ]
61 ++ lib.flatten (lib.attrValues optional-dependencies);
62
63 disabledTests = [
64 # presumably regressed in pytest-asyncio 0.23.0
65 "test_get_remote_position_too_old"
66 ];
67
68 preCheck = ''
69 export TZDIR=${tzdata}/${python.sitePackages}/tzdata/zoneinfo
70 export PATH=$out/bin:$PATH
71 '';
72
73 pythonImportsCheck = [ "bimmer_connected" ];
74
75 meta = with lib; {
76 changelog = "https://github.com/bimmerconnected/bimmer_connected/releases/tag/${version}";
77 description = "Library to read data from the BMW Connected Drive portal";
78 mainProgram = "bimmerconnected";
79 homepage = "https://github.com/bimmerconnected/bimmer_connected";
80 license = licenses.asl20;
81 maintainers = with maintainers; [ dotlambda ];
82 };
83}