1{
2 lib,
3 aiohttp,
4 asyncclick,
5 buildPythonPackage,
6 cryptography,
7 fetchFromGitHub,
8 hatchling,
9 kasa-crypt,
10 mashumaro,
11 orjson,
12 ptpython,
13 pytest-asyncio,
14 pytest-freezer,
15 pytest-mock,
16 pytest-socket,
17 pytest-xdist,
18 pytestCheckHook,
19 pythonOlder,
20 rich,
21 voluptuous,
22}:
23
24buildPythonPackage rec {
25 pname = "python-kasa";
26 version = "0.10.2";
27 pyproject = true;
28
29 disabled = pythonOlder "3.9";
30
31 src = fetchFromGitHub {
32 owner = "python-kasa";
33 repo = "python-kasa";
34 tag = version;
35 hash = "sha256-OIkqNGTnIPoHYrE5NhAxSsRCTyMGvNADvIg28EuKsEw=";
36 };
37
38 build-system = [ hatchling ];
39
40 dependencies = [
41 aiohttp
42 asyncclick
43 cryptography
44 mashumaro
45 ];
46
47 nativeCheckInputs = [
48 pytest-asyncio
49 pytest-freezer
50 pytest-mock
51 pytest-socket
52 pytest-xdist
53 pytestCheckHook
54 voluptuous
55 ];
56
57 optional-dependencies = {
58 shell = [
59 ptpython
60 rich
61 ];
62 speedups = [
63 kasa-crypt
64 orjson
65 ];
66 };
67
68 pytestFlags = [ "--asyncio-mode=auto" ];
69
70 disabledTestPaths = [
71 # Skip the examples tests
72 "tests/test_readme_examples.py"
73 ];
74
75 pythonImportsCheck = [ "kasa" ];
76
77 meta = with lib; {
78 description = "Python API for TP-Link Kasa Smarthome products";
79 homepage = "https://python-kasa.readthedocs.io/";
80 changelog = "https://github.com/python-kasa/python-kasa/blob/${version}/CHANGELOG.md";
81 license = licenses.gpl3Plus;
82 maintainers = with maintainers; [ fab ];
83 mainProgram = "kasa";
84 };
85}