1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch2,
6
7 # build-system
8 setuptools,
9 setuptools-scm,
10
11 # dependencies
12 httpx,
13 pycryptodome,
14
15 # tests
16 pytestCheckHook,
17}:
18
19buildPythonPackage rec {
20 pname = "msmart-ng";
21 version = "2025.3.3";
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "mill1000";
26 repo = "midea-msmart";
27 tag = version;
28 hash = "sha256-M8Gl6QXj0tRN7VFDhop47vINk8MeWSyCJ9bboo3j8Go=";
29 };
30
31 patches = [
32 (fetchpatch2 {
33 # Revert <https://github.com/mill1000/midea-msmart/pull/209> until setuptools
34 # implements support for <https://peps.python.org/pep-0639/>.
35 name = "revert-pyproject-license-declaration-pep639-syntax.patch";
36 url = "https://github.com/mill1000/midea-msmart/commit/e5d6a982135e497c251095e421d3de4686f36056.patch?full_index=1";
37 hash = "sha256-+mxmFGZd04MZY2C5eo4k1lFoXsM8XyeJNazShnjAseE=";
38 revert = true;
39 })
40 ];
41
42 build-system = [
43 setuptools
44 setuptools-scm
45 ];
46
47 dependencies = [
48 httpx
49 pycryptodome
50 ];
51
52 nativeCheckInputs = [ pytestCheckHook ];
53
54 disabledTestPaths = [
55 # network access
56 "msmart/tests/test_cloud.py"
57 ];
58
59 pythonImportsCheck = [ "msmart" ];
60
61 meta = with lib; {
62 changelog = "https://github.com/mill1000/midea-msmart/releases/tag/${src.tag}";
63 description = "Python library for local control of Midea (and associated brands) smart air conditioners";
64 homepage = "https://github.com/mill1000/midea-msmart";
65 license = licenses.mit;
66 mainProgram = "msmart-ng";
67 maintainers = with maintainers; [
68 hexa
69 emilylange
70 ];
71 };
72}